Hi,
I'm trying to convert this named scop from AR to DM:
named_scope :contract, lambda { |month|
d = Date.from_contract_month(month)
{ :conditions => ['EXTRACT(YEAR from expiration_date) = ? and
EXTRACT(MONTH from expiration_date) = ?',
d.year, d.month ]
}
}
It uses some postgres functions and I was wondering if there's any
abstractions for things like this in DM ?
Sort of like
def self.contract(month)
all(:expiration_date.year => d.year, :expiration_date.month =>
d.month)
end
I can do it with an SQL query in DM, just wanted to check if there's
some abstraction that can get me out of doing that. I saw a thread
related to this sort of thing from end of 2008 and dug around on
github but didn't see anything.
Thanks,
Patrik
--
You received this message because you are subscribed to the Google Groups
"DataMapper" 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/datamapper?hl=en.