I use this kind of conditional around the place too.

I'm -1 on adding more dynamic methods though. I'd sooner see something like 
`#changed?` extended:

p = Person.new
p.name = 'Nicholas'
p.changed? => true
p.changed?(:name) => true
p.changed?(:age) => false
p.changed?(name: 'Nicholas') => true
p.changed?(name: 'Nick') => false

What do you think?

On Tuesday, November 26, 2013 8:50:05 PM UTC+11, Yarin Go wrote:
>
> In many cases I see this kind of condition:
>
> if status_id_changed? && status_id == Status::ACCEPTED
>
> So maybe it will be nice to introduce a new method like:
>
> if status_id_changed_to?(Status::ACCEPTED)
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to