Can someone please help a very eager Rails newbie?

ok, so I am trying to learn the 'c' in crud from a tutorial right now. Using the source below, I am loading the action 'new', filling out a form to create a new record, and submitting the form to save the record. The problem comes when I submit the form. The app generates an error saying that the method commit= is not defined. At this point, I don't know enough about rails to extrapolate meaning from this weirdness or to know what I should include in this request that'd help someone to help me.

ok, so I am trying to learn the 'c' in crud from a tutorial right now. Using the source below, I am loading the action 'new', filling out a form to create a new record, and submitting the form to save the record. The problem comes when I submit the form. The app generates an error saying that the method commit= is not defined. At this point, I don't know enough about rails to extrapolate meaning from this weirdness or to know what I should include in this request that'd help someone to help me.

The short version is that there are parameters that are submitted that don't correspond to model attributes (eg the name of the button you clicked), so when you give Artists.new your params hash there are some keys it doesn't know what to do with.

Id: <%= text_field(:id, @album.id) %><br />

You don't need an edit field for id.

Artist: <%= text_field(:artist, @album.artist) %><br />

You've got the wrong pattern here. You should be doing text_field 'album', 'artist' (and similarly for the other ones) This tells rails 'I'm editing an album, and right now i'm looking at the artist attribute. This also makes what the user types appear as params[:album][:artist], so instead of doing Album.new params you do Album.new params[:album] and since params[:album only contains what you put there you won't get the error message you got. Fred

alright! thanks so much for the speedy and helpful answer. the only thing that is more fun than ruby/rails is how awesome the community is =]

A Love of Surf wrote:

  def create     @album = Album.new(params)

Until you learn to use form_for, or Hash#block, you must break out all the arguments to .new:

   @album = Album.new(:artist => params[:artist],                       :title => params[:title],                       :etc => params[:etc])

Also, next time don't worry about pasting the entire stack trace; it just fills up the servers, and we honestly won't read a line of it!

ok, i'm sorry about putting that huge text in my post.

but, i dont know what you mean about paste...i typed that