I am developing a rails app and I have 2 different user’s role: advanced and basic.
Instead of to hide links in the basic user’s views (a.i. using CanCan ) I want to manage 2 different set of views: one for the advanced user and one for basic user.
Currently I am working in this way:
case current_operator.op_type
when 'basic'
format.html { render :template => "devices/index_basc.html.erb" }
when 'advanced'
format.html # index.html.erb
end
But I dont like to specify at every action the template for the basic user ( { render :template => “devices/index_basc.html.erb” } )
I think there is some other way (I hope more neat 🙂
Do you have any ideas ?
Thank you,
Alessandro
You can do something like in this Railscast Mobile Devices:
in
config/initializers/mime_types.rbadd:in
app/controllers/application_controller.rbadd:Now you can just do the following in your controllers: