Created
June 24, 2009 14:07
-
-
Save zhhz/135293 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dm modle | |
class SampleOrder | |
include DataMapper::Resource | |
property :id, Serial | |
property :order_no, String | |
... | |
before :save, :set_order_no | |
def set_order_no | |
attribute_set(:order_no, next_order_no) if order_no.nil? || order_no.blank? | |
end | |
private | |
def next_order_no | |
... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment