Created
October 1, 2014 23:27
-
-
Save denishaskin/d97455e6f91e58c4f96d to your computer and use it in GitHub Desktop.
ordering fields_for
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def edit | |
@agency = Agency.find(params[:id]) | |
# add comments for locales that don't have comments yet, so we can present fields to the user | |
(I18n.available_locales.map(&:to_s) - @agency.comments.pluck(:locale)).each do |loc| | |
@agency.comments.build locale: loc | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= simple_form_for @agency do |f| | |
= f.simple_fields_for :comments do |c| | |
= c.input :comment, label: "#{c.object.locale} comment:" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment