Ruby on Rails Thursday, December 1, 2011

On 1 December 2011 00:54, Craig White <craig.white@ttiltd.com> wrote:
>
> On Nov 30, 2011, at 3:31 PM, Mauro wrote:
>
>> I want to display different layouts based on user.
>> If user is "intraOp" the I want to use layout intraOp, if user is
>> "interOp" I want to display layout interOp while if controller_devise
>> I want to display application layout.
>> I based the user selection on request.path.
>> If request.path is /intraOp then I select user IntraOp, if /interOp
>> then select user interOp and so on.
>> The routes.rb is:
>>
>> match "intraOp" => "companies#index"
>> match "interOp" => "companies#index"
>>
>> The problem is that I use pagination.
>> When the request.path is /interOp companies#index is launched, and are
>> displayed 10 companies with pagination.
>> When I click for displaying page 2 companies#index is launched but the
>> path is not /interOp/companies......... but is
>> /intraOp/companies.........that is because companies#index is first
>> matched with "intraOp".
>> Have you some suggestions to solve the problem to having different
>> layouts based on user?
>> I prefer to not create two controllers: intraOp and interOp.
> ----
> stuff the 'company' into the users session and you can use the session value everywhere, all the time (or not)

Sorry for my ignorance, can you explain better?

--
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