Hey guys,
I'm beginning with Sinatra and using DataMapper as my ORM tool of choice.
I've been doing great, playing with this today, but I'm now stuck. I'd like
to add a custom method to one of my models, that would check some values of
an instance, make some comparisons and return a boolean.
I tried the following :
class Day
include DataMapper::Resource
property :id, Serial
property :day_number, Integer
property :status, Integer, :default => 0
property :date, Date
*
def self.more_than_fifty?
# Just for the sake of the example
rand(1..100) > 50
end*
end
But didn't work. I've seen one or two cryptic messages on Stack Overflow
about DataMapper::Model.append_inclusions, but not enough for me to
understand and get it working.
Anyone who could help me around here ? Thanks a lot for your time guys.
Paddy
--
You received this message because you are subscribed to the Google Groups
"DataMapper" 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/datamapper?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.