I have this app that is supposed to take as input several parts of a
blog entry and save it in a table. I did the migration to create the
tables and the created a partial for the form to enter the data. I hit
the submit button and the I get:
undefined method `save' for . . .
My table has the correct models mapped to it and it is hitting the
controller correctly because it's displaying the message, but when it
hits 'save', as far as I can tell, there should be no reason why it
doesn't work. Here is the cotroller code:
I have this app that is supposed to take as input several parts of a
blog entry and save it in a table. I did the migration to create the
tables and the created a partial for the form to enter the data. I hit
the submit button and the I get:
undefined method `save' for . . .
My table has the correct models mapped to it and it is hitting the
controller correctly because it's displaying the message, but when it
hits 'save', as far as I can tell, there should be no reason why it
doesn't work. Here is the cotroller code:
if !@entry.nil? and @entry.save
render :inline => '<h1>' + @entry.header + '</h1>'
else
flash[:notice] = 'ERROR'
render :partial => 'entry_form', :id => @user.id
end
end
You've set @entry to be params[:blog]. Hashes don't have a save
method. Maybe you meant @entry = Blog.new(params[:blog) or @entry.attributes = params[:blog]