I''ve added a new column, "offset", to my "users" table, set the corresponding model to validate_presence_of offset, and added the field to my "add user" view: <%= select("user", "offset", %w{ -6 }) %> (Simplified here to a single option) From the console: Parameters: {"user"=>{"name"=>"tommy", "password"=>"gun", "offset"=>"-6"}, "action"=>"login", "controller"=>"users"} So there''s an option selected and the offset parameter makes POST. Why then doesn''t this pass validation? Rails tells me this: "Offset can''t be blank" WTF? -- 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 -~----------~----~----~----~------~----~------~--~---
Justin Skolnick wrote:> I''ve added a new column, "offset", to my "users" table, set the > corresponding model to validate_presence_of offset, and added the field > to my "add user" view: > > <%= select("user", "offset", %w{ -6 }) %> > > (Simplified here to a single option) > > From the console: > Parameters: {"user"=>{"name"=>"tommy", "password"=>"gun", > "offset"=>"-6"}, > "action"=>"login", "controller"=>"users"} > > So there''s an option selected and the offset parameter makes POST. Why > then doesn''t this pass validation? Rails tells me this: > > "Offset can''t be blank" > > WTF?There is no controller code there. The parameters are being created correctly, but what are you doing with them to create your object? That is most likely where your problem lies. -- 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 -~----------~----~----~----~------~----~------~--~---
There''s also no model code. Is the attribute protected? Bill -- 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 -~----------~----~----~----~------~----~------~--~---
devaulw wrote:> There''s also no model code. Is the attribute protected? > > BillAh! Bill wins. Thanks. -- 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 -~----------~----~----~----~------~----~------~--~---