Answer the question
In order to leave comments, you need to log in
How is it implemented on toster.ru in the profile adding links to social networks, jabber, etc.?
Is it really many to one
class User < ActiveRecord::Base
has_many :links, dependent: :destroy
end
class Link < ActiveRecord::Base
belongs_to :user
end
Answer the question
In order to leave comments, you need to log in
I did so
<%= form_for @festival do |festival_form| %>
<div id="social_networks_fields">
<%= festival_form.fields_for :social_networks do |social_network_fields| %>
<%= render 'social_network_fields', f: social_network_fields %>
<% end %>
</div>
<% end %>
<!--_social_network_fields.html.erb-->
<%= f.select :network, SocialNetwork.networks.keys %>
<%= f.text_field :link %>
class SocialNetwork < ActiveRecord::Base
belongs_to :festivals
enum network: [:facebook, :vkontakte, :twitter, :linkedin, :vimeo, :flickr,
:google, :youtube]
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question