Hello. I have a model Profile with an attribute named ''descriptions_of_like''. ''desctiptions_of_like'' - is a string, which I convert into an array for working with them and before saving in table convert into a string. (It''s a not a best way, i think, but the first thing that comes to mind). How can i manage this lisk of descriptions with form_for? I write this: <div id = ''descriptions''> <% form_for @user do |f| %> <% @list_of_descriptions.each do |i| %> <% f.check_box :i %> <% end %> <% end %> </div> where @list_of_descriptions @user.descriptions_of_like.split(%r{,\s*}) and get error "undefined method `i''" -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
When you do f.check_box(:i) Rails expects the model for the form instance (in this case, User) to have an attribute called "i". You can use the "check_box_tag" helper to generate a check box that is not tied to a model. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''ve read what you posted and I''m still not sure what you are trying to do here. Start out by providing the following and use (http://gist.github.com) for posting the code for readability. Model Files: post your user.rb and profile.rb Schema: post your schema for user and profile Controller Files: post your profiles_controller.rb Then, answer what you are trying to do with the checkbox. And, while you are at it, review this here so you can understand how to properly write a form_for - http://guides.rubyonrails.org/form_helpers.html You''ll find form_for in section 2.2. After you post that, just provide a short summary of how you feel the logic should work with these controllers. Example: When going to the profiles index I expect to see the following: .. field_one : string containing x.. .. field_two : integer containing y.. etc.. Given this, anyone should be able to answer your question. Thanks mate. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.