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:
def add_entry
@entry = Blog.new
@entry = params[:blog]
@user = User.find_by_id(params[:id])
if [email protected]? and @entry.save render :inline => '<h1>' + @entry.header + '</h1>' else flash[:notice] = 'ERROR' render :partial => 'entry_form', :id => @user.id end
end
Anyone have any ideas? thanks,
-S