[Rails] Newb question- method not working
Dark Ambient
sambient at gmail.com
Tue Aug 8 20:51:41 GMT 2006
Wow ..weird problem , I did the simple id search and get back:
Couldn't find User with ID=29761836
Which would be correct but I guess the problem is somewhere else.
Stuart
On 8/8/06, Jan Prill <jan.prill at gmail.com> wrote:
> Hi Stuart,
>
> try User.find(session[:user]) instead. Rails is often that simple.
>
> The way of doing things in a condition would be User.find(:first, :condition
> => ["name like ?", name]) but this isn't necessary for a simple id-search.
>
> Cheers,
> Jan
>
>
> On 8/8/06, Dark Ambient <sambient at gmail.com> wrote:
> >
> I know this shouldn't be in the view but to test the code it is.
> Anyway if I do just session[user] I get back the user id (the id from
> the user table)
> which is good.
> However this code does not work.
>
> <% a = session[:user] %>
> <% uname = User.find(:first, :conditions => id = a) %>
> <%= @uname %>
>
> TIA
> Stuart
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>
More information about the Rails
mailing list