I’m working on user authentication system to get familiar with rails,
and have basically solved most of my apps problems till now. I keep
getting the NoMethodError, and can’t understand why.
class Customer < ActiveRecord::Base
salt = Customer.random_string(10) if !salt?
self.hashed_password = Customer.encrypt_password(@password, salt)
require File.dirname(FILE) + ‘/…/test_helper’
class CustomerTest < Test::Unit::TestCase
self.use_instantiated_fixtures = true
@longbob.password = @longbob.password_confirmation = "newlongpassword" assert @longbob.save c = Customer.new c.email_address = "[email protected]"
c.password = c.password_confirmation = "magicwand" assert c.save
The error I keep getting is this (it happens in all of my tests):
NoMethodError: undefined method
password=' for #<Customer:0x343de40> C:/Program Files/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1789:inmethod_missing’
I’m not sure what I’m doing wrong, but I’m 100% sure that the password
method exists for that model. Any ideas?