likonar

Maxim Gorbul
0
2
  • Project to help learning Git
    Created Thu Mar 06 12:06:49 -0800 2008
    legend
  • Merb powered forum inspired by Beast
    Forked from shayarnett/merbums Wed Jun 11 14:33:20 -0700 2008
    legend

Following

Public Activity  feed

likonar commented on rails/rails 2 months ago
Comment in 92cd881:

The following code was working on rails 2.0 and doesn’t work on 2.1:
class Person < ActiveRecord::Base
validates_uniqueness_of :email
def self.find(*args)
with_scope(:find => { :conditions => ["status = ?", true]}) do
super
end
end
end
>> p1 = Person.new(:email => "test@domain.com", :status => true)
=> #<Person id: nil, email: "test@domain.com", status: true>
>> p2 = Person.new(:email => "test@domain.com", :status => true)
=> #<Person id: nil, email: "test@domain.com", status: true>
>> p1.save!
=> true
>> p2.save!
ActiveRecord::RecordInvalid: Validation failed: Email has already been taken
>> p1 = Person.find(1)
=> #<Person id: 1, email: "test@domain.com", status: true>
>> p1.status = false
=> false
>> p1.save!
=> true
>> p1 = Person.find(1)
ActiveRecord::RecordNotFound: Couldn’t find Person with ID=1
>> p2.save!
ActiveRecord::RecordInvalid: Validation failed: Email has already been taken
>> Person.find :all
=> []

likonar started watching jspec 3 months ago
jspec is at wycats/jspec
likonar started watching dm-core 3 months ago
dm-core is at wycats/dm-core
likonar started watching dm-adapters 3 months ago
dm-adapters is at wycats/dm-adapters
likonar started watching merb-more 3 months ago
merb-more is at wycats/merb-more
likonar started watching merb-plugins 3 months ago
merb-plugins is at wycats/merb-plugins
likonar forked merbums 3 months ago
Forked repository is at likonar/merbums
likonar started watching merbums 3 months ago
merbums is at shayarnett/merbums
likonar started watching merb-core 3 months ago
merb-core is at wycats/merb-core
likonar committed to likonar/helloworld 7 months ago

6b8051d13ef6f240365e4b8afb4c60754729d967

Merge commit 'efren/master'