Hi

Could anybody help me resolve this error?, i have copy n pasted my
controler and activerecord below as well.....Here is the error medssage


NoMethodError in Register_user#index
Showing app/views/register_user/index.html.erb where line #4 raised:

undefined method `screen_name' for #<User:0x13027a3>



Extracted source (around line #4):

1: <h1>Users</h1>
2: <ol>
3: <% @users.each do |user| %>
4:   <li><%= user.screen_name %></li>
5: <% end %>
6: </ol>

-----------------------------------------------------

CONTROLLER

class RegisterUserController < ApplicationController
 def register
    @title = "Register"
    if request.post?
      @user = User.new(params[:user])
            if @user.save
        flash[:notice] = "User with login #{@user.screen_name} created
successfully!"
        redirect_to :action => :index
      end
    end
  end



  def index
     @title = "Temporary View"
    @users = User.find(:all)

  end


  def login
  end

  def logout
  end


end
--------------------------------------

DATABASE

class CreateRegisterUsers < ActiveRecord::Migration
  def self.up
    create_table :register_users do |t|

      t.column :screen_name,            :string
      t.column :e_mail, :string
      t.column :password, :string

     #t.string :screen_name
     #t.string :e_mail
     #t.string :password

      t.timestamps
    end
  end

  def self.down
    drop_table :register_users
  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