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*})
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.