NoMethodError in UsersController#show

So I am getting the error

NoMethodError in UsersController#show error
undefined method `feed’ for nil:NilClass

“commit”=>“Log in”}

Why is login being set to “session”? Instead of the real login?

This is my form:

<% form_tag session_path do %>

Login <%= text_field_tag 'login' %>

        <p><label class="block" for="password">Password</label>
        <%= password_field_tag 'password' %></p>

        <!-- Comment this if you don't want this functionality -->
        <p><label for="remember_me">Remember me:</label>
        <%= check_box_tag 'remember_me' %></p>

        <p><%= submit_tag 'Log in', :class => "btn", :id =>

“login_btn” %> <%= link_to “Sign Up”, new_user_path %>

<% end %>

Here are the relevant controllers and models:
def show
#@user = User.find(params[:id])
@user = User.find_by_login(params[:login])
#@feed_items = @user.feed
@feed_items = @user.feed

Users Model:
def feed
#Post.all(:conditions => [“user_id = ?”, id])

Post Model (using SQLite3) :
named_scope :from_users_subscribed_by, lambda { |user|
subscribed_by(user) }


# Return an SQL condition for users followed by the given user.
# We include the user's own id as well.
def self.subscribed_by(user)
  subscribed_ids = %(SELECT subscribed_id FROM subscriptions

WHERE subscriber_id = :user_id)
{ :conditions => [“user_id IN (#{subscribed_ids}) OR user_id =
{ :user_id => user }] }

Ok, so I found the issue. The below resource in my routes is the issue.

map.profile_link ‘/:login’, :controller => ‘users’, :action => ‘show’

I used this to try and get Twitter-like urls so something like

So what was happening anything after was being set at the
:login so I am not sure how to get the Twitter-like urls plus have
things like or

Anyone have any clues?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs