On 11 September 2010 11:34, Anders_P <[email protected]> wrote: > Hello! > I'm trying to create a list of user "ads" on my home page in my app. > But I don't get it to work. I'm a rails noob so it might be something > trivial. > I'm currently running into this error: > > Couldn't find User without an ID
There should be a lot more information available with the error, including where it has failed. The clue may be in the error message though, it is trying to find a user and there is no id. > > My pages controller where to home action is looks like this: > > def home > �...@title = "Startsidan" > �...@user = User.find(params[:id]) Possibly this is the problem line, if so then perhaps params[:id] is nil (hence the error message). Have a look in the log (log/development.log) and it will tell you what the params are. Are you passing the id to the home action? Also you could have a look at the rails guide on debugging to see how to break into your application using ruby-debug and examine the data at that point. Colin > �...@ads = �[email protected](:page => params[:page]) > end > > And my ad partial looks like this: > > <div class="ad body_copy"> > <%= image_tag user.avatar.url(:thumb) %> > <span class="content"> > <%= link_to user.name, user %> > <%= user.ads.content %> > </span> > </div> > > Any help would be appreciated! I hope that my explanation is clear > enough. > > Best regards > Anders > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

