Hi,any ideas how to fix this error, im trying to create a users
login.register. which i have called users1. Here is the error message
i9n my view.Thanks


NoMethodError in User1#index
Showing app/views/user1/index.html.erb where line #6 raised:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each

Extracted source (around line #6):

3:
4: <h1>Users1</h1>
5: <ol>
6: <% @users.each do |user1| %>
7:   <li><%= user1.screen_name %></li>
8: <% end %>
9: </ol>


My Controller

class User1Controller < ApplicationController
  def index
    @title = "Temporary View"
    @users = User1.find(:all)
  end

  def register
    @title = "Register"

  if @user.save
        flash[:notice] = "User with login #{@user.screen_name} created
successfully!"
        print "1_User with login #{@user.screen_name} created
successfully!"
        redirect_to :action => :index
      else
        print "2_User with login #{@user.screen_name} created
successfully!"
        #print "3_User with login #{@user1.screen_name} created
successfully!"
      end
    end
end


  def login
  end


my database Migration


class CreateUser1s < ActiveRecord::Migration
  def self.up
    create_table :user1s do |t|
      t.string :screen_name
      t.string :e_mail
      t.string :password

      t.timestamps
    end
  end

  def self.down
    drop_table :user1s
  end
end

-- 
Posted via http://www.ruby-forum.com/.

-- 
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.

Reply via email to