Hello, everybody: I have made a "form_for" in a view returns the attributes value of a "user" model, such as user.login, user.email, user.name, ect. However, now I wanna add a new , e.g. "code", into the form_for tag, and return it to next action. The question is this attribute doesn''t belong to "user" model, it is simply a string i would like to deliver to next action. Once I try this , it errors: undefined method `number'' for #<User:0xb5924cac>. Is the "form_for" tag merely able to convey model''s attribute value? ===============<% form_for :user, :url => {:action => ''create''} do |f| -%> 6: <p><label for ="code">Protect Image:</label><br /> 7: <%= f.text_field :code%> ================ Br, MyST --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Try using <%= text_field_tag "number" %> instead of f.text_field On Jan 30, 2008 8:30 PM, myst_tt <tdxiaoxi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello, everybody: > I have made a "form_for" in a view returns the attributes value of > a "user" model, such as user.login, user.email, user.name, ect. > However, now I wanna add a new , e.g. "code", into the form_for > tag, and return it to next action. The question is this attribute > doesn''t belong to "user" model, it is simply a string i would like to > deliver to next action. Once I try this , it errors: undefined > method `number'' for #<User:0xb5924cac>. > Is the "form_for" tag merely able to convey model''s attribute > value? > > ===============> <% form_for :user, :url => {:action => ''create''} do |f| -%> > 6: <p><label for ="code">Protect Image:</label><br /> > 7: <%= f.text_field :code%> > ================> > Br, > MyST > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks! I used to conside text_filed_tag should be only used in "form_tag".. :) Br, MyST On Jan 30, 12:10 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Try using <%= text_field_tag "number" %> instead of f.text_field > On Jan 30, 2008 8:30 PM, myst_tt <tdxia...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Hello, everybody: > > I have made a "form_for" in a view returns the attributes value of > > a "user" model, such as user.login, user.email, user.name, ect. > > However, now I wanna add a new , e.g. "code", into the form_for > > tag, and return it to next action. The question is this attribute > > doesn''t belong to "user" model, it is simply a string i would like to > > deliver to next action. Once I try this , it errors: undefined > > method `number'' for #<User:0xb5924cac>. > > Is the "form_for" tag merely able to convey model''s attribute > > value? > > > ===============> > <% form_for :user, :url => {:action => ''create''} do |f| -%> > > 6: <p><label for ="code">Protect Image:</label><br /> > > 7: <%= f.text_field :code%> > > ================> > > Br, > > MyST > > -- > Ryan Bigghttp://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---