On 26 Jan 2008, at 06:13, Shandy Nantz wrote:
>
> 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 !@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]
Fred> Anyone have any ideas? thanks,
>
> -S
> --
> Posted via http://www.ruby-forum.com/.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---