Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validates_inclustion_of => NoMethodError #7

Open
BlackReloaded opened this issue Sep 27, 2010 · 2 comments
Open

validates_inclustion_of => NoMethodError #7

BlackReloaded opened this issue Sep 27, 2010 · 2 comments

Comments

@BlackReloaded
Copy link

Hi,

the following class

class Account
include SimplyStored::Couch
property :name
property :type
validates_inclusion_of :type, :in => ["a","b"]
end

leads to following error :
undefined method `add_validations' for Account:Class

the following works fine:
validates_presence_of :type

my configuration: rails 3.0.0, ruby 1.8.7, gem 1.3.7, simply_stored 0.3.8, validatable 1.6.7

@jweiss
Copy link
Collaborator

jweiss commented Sep 28, 2010

This works for me:

#!/usr/bin/env ruby

require 'rubygems'
gem 'rails', '3.0.0'
require 'simply_stored/couch'

CouchPotato::Config.database_name = 'test_foo'

class Account
 include SimplyStored::Couch
 property :name
 property :type
 validates_inclusion_of :type, :in => ["a","b"]
end

a = Account.new
  a.name = 'Bert'
a.type = 'a'
a.save!

puts "Got #{Account.count} Accounts in the DB"

With Rails 3.0.0., Ruby 1.8.7, Rubygems 1.3.7, SimplyStored 0.3.9, and validatable 1.6.7.

Can you please try again with SimplyStored 0.3.9 as it behaves a bit more nicely with ActiveSupport 3.0.0?

@michaelkirk
Copy link

I was having similar behavior, until I explicitly included Validatable in my class.

class Product
  include SimplyStored::Couch
  include Validatable #without this line I get "NoMethodError (add_validations)
  property :name
  validates_uniqueness_of :name
end

Using rails (3.0.3)
Using simply_stored (0.3.9)
Using mattmatt-validatable (1.8.4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants