if model.compiled_this_week.first.empty?
OR
if model.compiled_this_week.find(:first).empty?
.. return undefined method empty?
if model.compiled_this_week.all.empty?
OR
if model.compiled_this_week.find(:all).empty?
.. work as expected
compiled_this_week is a named scope applied to specific date/search
conditions.
named_scope :compiled_this_week, lambda { { :conditions => ['created_at
> ? and created_at < ?', Time.now.beginning_of_week,
Time.now.end_of_week] } }
Any reason why this returns undefined method?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---