[Rails] Re: Re: Re: Find account name

2010-10-15 Thread Leonel *.*
>> 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

[Rails] Re: Re: Re: Find account name

2010-10-14 Thread Marnen Laibow-Koser
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

[Rails] Re: Re: Re: Find account name

2010-10-14 Thread Leonel *.*
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

[Rails] Re: Re: Re: Find account name

2010-10-14 Thread Leonel *.*
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