I have in开发者_运维技巧put/select on Formtastic form
f.input :some_model_values, :as => :select
The problem is i need to pre define :some_model_values. Because some users roles have to see all list, and some others not.
How it can be done?
Thanks.
in your view:
f.input :property, :as => :select, :collection => get_property_collection(@user)
in your helper:
def get_property_collection(user)
case
when user.is_admin?
[ "foo", "bar" ]
else
[ "some", "thing" ]
end
end
精彩评论