Skip to content

Instantly share code, notes, and snippets.

@alduro
Created May 4, 2011 20:44
Show Gist options
  • Save alduro/955995 to your computer and use it in GitHub Desktop.
Save alduro/955995 to your computer and use it in GitHub Desktop.
class Attendee < Ohm::Model
attribute :email
attribute :hash
attribute :group
attribute :prefix
attribute :ami_instance
attribute :confirmed
attribute :expires_on
attribute :expires_at
index :hash
index :confirmed
index :email
def validate
super
assert_present :hash
assert_unique :hash
assert_present :email
assert_unique :email
end
# @return [Hash] A hash representation of an {Attendee}
def to_hash
attendee = {:email => email, :hash => hash, :group => group, :prefix => prefix, :ami_instance => ami_instance, :confirmed => confirmed }
super.merge(attendee)
end
end
@alduro
Copy link
Author

alduro commented May 4, 2011

NoMethodError - undefined method empty?' for nil:NilClass: /usr/lib/ruby/gems/1.8/gems/ohm-0.1.3/lib/ohm.rb:952:inassert_unique'
./lib/models.rb:19:in validate' /usr/lib/ruby/gems/1.8/gems/ohm-0.1.3/lib/ohm/validations.rb:134:invalid?'
/usr/lib/ruby/gems/1.8/gems/ohm-0.1.3/lib/ohm.rb:1453:in create' /usr/lib/ruby/gems/1.8/gems/ohm-0.1.3/lib/ohm.rb:1365:increate'
./prov_app.rb:198:in POST /send_invites' ./prov_app.rb:193:ineach'
./prov_app.rb:193:in `POST /send_invites'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment