I have a strong handle on when to use a helper -- at least I think so. A helper may include some logic (not enough to belong in the model) and it presents html as its output. So I have a conceptual problem about this solution that I've built:
#helpers/people_helper.rb
def person_roles
(%W(assistant author collector editor foreword illustrator interviewer introduction narrator notes translator) + Role.group('name').map(&:name)).uniq().sort
end
I use the output in a view, as part of a collection_select picker for a string-based attribute. This picker has a JavaScript "combobox" behavior added to it, so the editor can add new roles to the list at whim. But the output is an array. Does this invalidate my use of a helper method? Or am I thinking too much about the label "helper" here?
Thanks,
Walter
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment