1 2 3 |
errors.add(:is_current, 'should have only one current status') if self.is_current_equals(true).length > 1 end |
in Console
1 2 3 4 5 6 7 |
>> Location.country_equals('Indonesia').length => 3 >> cq = Quiz.new(:name => 'ano', :is_current => true) => #<Quiz id: nil, name: "ano", created_at: nil, updated_at: nil, is_current: true> >> cq.save NoMethodError: undefined method `is_current_equals' for #<Quiz:0x10339e1b8> |

