On Thursday, November 15, 2012 5:16:14 PM UTC, Colin Law wrote:
>
>
> I was trying to ask the general question, that if one has a scope and
> a class method that perform exactly the same operation (such as the
> example in this thread), so
>
> scope :today_reservations, lambda { where("reserved_from > ? and
> reserved_to <= ?", Date.today, Date.today ) }
>
> and
>
> self.today_reservations
> where("reserved_from > ? and reserved_to <= ?", Date.today, Date.today
> ) }
> end
>
> Is there actually any difference between the two, or is the former
> just a way of defining the latter in a railsy sort of way?
>
>
> I believe some consider the existance of scope :blah, ... to be an error -
it adds complexity internally and the potential for the super common lack
of lambda error without adding any functionality. I can't remember who said
it though.
Fred
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/RR6B7oSRMCoJ.
For more options, visit https://groups.google.com/groups/opt_out.