Undefined method save

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

On 26 Jan 2008, at 06:13, Shandy N. wrote:

hits ‘save’, as far as I can tell, there should be no reason why it
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]

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs