Hans
unread,Jul 24, 2010, 11:00:57 AM7/24/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Talk
I am refactoring my views and have learned that to separate view
controller and models and that the view is feed from the controller
that defines the instance variables related to a the models that is to
be used in views-
I have also learned that the number of inctace variables should be
limited to 1-2 in each action.
My question is about how to handle public class methods.
In some actions I have many such methods for objects as Person, User
etc and I could either define instance variables (but there will then
be to many) or specific presenters for these variables or putting them
directly into the views to define i.e select_tags with different
option lists
What solution is to be preferred ?
select_tag(:person_id, options_for_select(@people_list.insert(0,
['Select a person',0]),@selected_person.to_s),...
select_tag(:person_id, options_for_select(Person.all_people.insert(0,
['Select a person',0]),Person.current.to_s),..
select_tag(:person_id,
options_for_select(PeoplePresenter.all_people.insert(0,['Select a
person',0]),PeoplePresenter.current_person.to_s),..
etc