>> So you mean doing something like this in the application controller?
>> def current_user
>> User.find_by_id(session[:user_id])
>> end
> That's usually sensible.
>
> Since current_user is defined in
> ApplicationController, and since all your other controllers inherit from
> ApplicationCo
Leonel *.* wrote in post #950292:
[...]
> So you mean doing something like this in the application controller?
> def current_user
> User.find_by_id(session[:user_id])
> end
>
That's usually sensible.
> I use the user id, the account id, the account name and the account id
> in several par
Colin Law wrote in post #950219:
> On 14 October 2010 17:27, Leonel *.* wrote:
>>
>> protect_from_forgery
>>
>> @user_id = User.find_by_id(session[:user_id])
>> @account_id = @user_id.account.id
>
> Doing it like that means that it will get executed when the controller
> loads, which in production
Colin Law wrote in post #950191:
> On 14 October 2010 16:32, Leonel *.* wrote:
>>
>> APPLICATION_CONTROLLER (error!)
>> User.find(session[:user_id]).account.name
>>
>> ERROR
>> Couldn't find User without an ID
>
> Can you show us the code around the error and how you are calling it?
mmm... I thin
4 matches
Mail list logo