For some strange reason I can''t get update_attributes to work. Any reason why that might be? here is my code: controller: def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) flash[:notice] = ''Your Information was successfully updated.'' format.html { redirect_to(user_url(@user)) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end view: <% form_for(:user, :url => user_url(@user), :html => { :method => :put }) do |f| %> <div class="optional"> <label for="city">First Name:</label> <%= f.text_field :first_name, :class => ''inputText'' %> </div> <div class="optional"> <label for="city">Last Name:</label> <%= f.text_field :last_name, :class => ''inputText'' %> </div> <p> <%=submit_tag "Update"%> </p> <% end %> -- 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 -~----------~----~----~----~------~----~------~--~---
Jimmy Palmer wrote:> For some strange reason I can''t get update_attributes to work. Any > reason why that might be?Any error messages in your logs? What are the parameters recorded in the log file that are passed into the #update call? You can also try using #update_attributes! so that an exception is raised which may give more information in your log file as to the problem... -- 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 -~----------~----~----~----~------~----~------~--~---
Mark Bush wrote:> Jimmy Palmer wrote: >> For some strange reason I can''t get update_attributes to work. Any >> reason why that might be? > > Any error messages in your logs? What are the parameters recorded in > the log file that are passed into the #update call? > > You can also try using #update_attributes! so that an exception is > raised which may give more information in your log file as to the > problem...That''s the thing...I''ve even put it in debug model and every thing seems to be correct. I tried the update_attributes! but no exception was raised. -- 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 -~----------~----~----~----~------~----~------~--~---
Jimmy Palmer wrote:> That''s the thing...I''ve even put it in debug model and every thing seems > to be correct. I tried the update_attributes! but no exception was > raised.Interesting. Have you tried calling #update_attributes on something from the application console (script/console)? -- 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 -~----------~----~----~----~------~----~------~--~---
Mark Bush wrote:> Jimmy Palmer wrote: >> That''s the thing...I''ve even put it in debug model and every thing seems >> to be correct. I tried the update_attributes! but no exception was >> raised. > > Interesting. > > Have you tried calling #update_attributes on something from the > application console (script/console)?yeah...tried that and it returned true but didn''t update the object. strange. -- 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 -~----------~----~----~----~------~----~------~--~---
Jimmy Palmer wrote:> yeah...tried that and it returned true but didn''t update the object.What does your log file show when you try this? Does it show the UPDATE SQL call? -- 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 -~----------~----~----~----~------~----~------~--~---
Mark Bush wrote:> Jimmy Palmer wrote: >> yeah...tried that and it returned true but didn''t update the object. > > What does your log file show when you try this? Does it show the UPDATE > SQL call?it does call it both from the console and the browser but it has the old values. -- 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 -~----------~----~----~----~------~----~------~--~---
Jimmy Palmer wrote:> it does call it both from the console and the browser but it has the old > values.Sounds like something fundamental is playing up. What DB adapter are you using? What versions of rails and activerecord? -- 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 -~----------~----~----~----~------~----~------~--~---
Mark Bush wrote:> Jimmy Palmer wrote: >> it does call it both from the console and the browser but it has the old >> values. > > Sounds like something fundamental is playing up. What DB adapter are > you using? What versions of rails and activerecord?this is weird. I added a couple more columns to my form and they updated fine. I added more and they would not update. I haven''t found a pattern yet, but still am digging. I''m using 2.0.2 and mysql. strange stuff...never seen this before. -- 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 -~----------~----~----~----~------~----~------~--~---
Jimmy Palmer wrote:> strange stuff...never seen this before.Neither have I. Sorry. -- 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 -~----------~----~----~----~------~----~------~--~---
Hi -- On Mon, 3 Mar 2008, Jimmy Palmer wrote:> > Mark Bush wrote: >> Jimmy Palmer wrote: >>> it does call it both from the console and the browser but it has the old >>> values. >> >> Sounds like something fundamental is playing up. What DB adapter are >> you using? What versions of rails and activerecord? > > this is weird. I added a couple more columns to my form and they > updated fine. I added more and they would not update. I haven''t found > a pattern yet, but still am digging. > > I''m using 2.0.2 and mysql. > > strange stuff...never seen this before.Can you post some of the non-working code? I''m just curious whether one might spot something. Also, do you have validations in your models? Not that that would necessarily account for what you''re describing, but just to get a fuller picture. David -- Upcoming Rails training from David A. Black and Ruby Power and Light: ADVANCING WITH RAILS, April 14-17 2008, New York City CORE RAILS, June 24-27 2008, London (Skills Matter) See http://www.rubypal.com for details. Berlin dates coming soon! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
David A. Black wrote:> Hi -- > > On Mon, 3 Mar 2008, Jimmy Palmer wrote: > >> updated fine. I added more and they would not update. I haven''t found >> a pattern yet, but still am digging. >> >> I''m using 2.0.2 and mysql. >> >> strange stuff...never seen this before. > > Can you post some of the non-working code? I''m just curious whether > one might spot something. Also, do you have validations in your > models? Not that that would necessarily account for what you''re > describing, but just to get a fuller picture. > > > David >I found my problem. Thanks for the help. -- 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 -~----------~----~----~----~------~----~------~--~---
On Mar 3, 2008, at 1:11 PM, Jimmy Palmer wrote:> David A. Black wrote: >> Hi -- >> >> On Mon, 3 Mar 2008, Jimmy Palmer wrote: >> >>> updated fine. I added more and they would not update. I haven''t >>> found >>> a pattern yet, but still am digging. >>> >>> I''m using 2.0.2 and mysql. >>> >>> strange stuff...never seen this before. >> >> Can you post some of the non-working code? I''m just curious whether >> one might spot something. Also, do you have validations in your >> models? Not that that would necessarily account for what you''re >> describing, but just to get a fuller picture. >> >> David > > I found my problem. Thanks for the help.OK, so tell the list what it was. That''s only fair. It let''s those who do use the search features of the Internet to find solutions as well as problems and provides a bit of closure to everyone who''s tried to help (or just had to delete the email; yes, many use email rather than the forum). -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I have a similar problem here. The SQL generated is perfect, but one of my models refuses to get updated. -- 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 -~----------~----~----~----~------~----~------~--~---
Got attr_protected on one of your model attributes? On 11/09/2008, at 20:05, Fernando Perez <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > wrote:> > I have a similar problem here. > > The SQL generated is perfect, but one of my models refuses to get > updated. > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Argh! I''m so stupid! I was updating a field and displaying another one which remains constant. Everything is working fine... except me :-D -- 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 -~----------~----~----~----~------~----~------~--~---