Hi --
On Thu, 10 Jul 2008, Dave Lynam wrote:
>
> So I am trying to do the simple action of updating user
> information(the model is named spec) that may not exist in the first
> place. Meaning I have one view for both new and update. I think
> theres something wrong with my variables or something, not sure...but
> here is my code:
>
> in the spec controller:
> def edit
> @title = ''Edit User Information''
> @user = logged_in_user
> @user.spec ||= Spec.new
> @spec = @user.spec
> end
>
> def update
> if @user.spec.update_attributes(params[:spec])
> flash[:notice] = "Specs updated"
> redirect_to user_path(logged_in_user)
> end
> end
>
> this is the edit view:
> <% form_for :spec, :url => spec_url,
> :html => { :method => :put } do |form| %>
> <fieldset>
> <legend><%= @title %></legend>
>
> <%= error_messages_for ''spec'' %>
> <%= text_field_for form, "first_name" %>
Try changing that to: form.text_field "first_name"
David
--
Rails training from David A. Black and Ruby Power and Light:
Intro to Ruby on Rails July 21-24 Edison, NJ
Advancing With Rails August 18-21 Edison, NJ
See http://www.rubypal.com for details and updates!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---