Hi Guys,

It's my first suggestion/post here so go easy on me :p 
So recently I've found myself writing scopes or functions like this: 
class SomeModel < ActiveRecord::Base

 scope :created_before, ->(timestamp) { where('created_at < ?', timestamp) }

end




class SomeModel < ActiveRecord::Base

  def self.updated_before(time)
    where('updated_at < ?', time)
  end

  def self.updated_after(time)
    where('updated_at > ?', time)
  end

  def self.updated_between(start_time, end_time)
    updated_after(start_time).updated_before(end_time)
  end

end


I would like to suggest the addition of these functions to ActiveRecord so 
all ActiveRecord Objects can inherit these functions (If time-stamps are 
enabled). 
If this feature is something people are interested in, I'd love the 
opportunity to dev this as I want to contribute and give back to the Rails 
community.

Let me know what you guys think :)

Will

-- 
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 rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to