views:

21

answers:

1

I have input/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.

A: 

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
KARASZI István