On Nov 11, 2010, at 4:55 PM, Alex Coles wrote: > On Thu, Nov 11, 2010 at 7:14 AM, Zhi-Qiang Lei <[email protected]> wrote: >> Dear All, >> >> Could you tell me why unique call is not found? Thanks. >> >> require "dm-sweatshop" >> >> module EIOU >> include DataMapper::Sweatshop::Unique >> Person.fixture {{ >> :email => unique { %r{...@\w+\.com}.gen }, >> :loans => (0..40).of {Loan.gen}, >> :debts => (0..40).of {Loan.gen} >> }} >> >> ... >> end >> >> Failures: >> 1) EIOU::User#realm should return #{[email protected] >> Failure/Error: user = User.gen >> undefined method `unique' for EIOU:Module >> # ./spec/../fixtures/model_fixtures.rb:15 >> # ./spec/../fixtures/model_fixtures.rb:20 >> # ./spec/model_spec.rb:10 > > If you're putting your fixtures in a module like this, you'll need to > use extend instead of include, i.e. > extend DataMapper::Sweatshop::Unique > instead of: > include DataMapper::Sweatshop::Unique > > Alex > > -- > 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. >
Thank you, Alex. This fix my problem. Best regards, Zhi-Qiang Lei [email protected] -- 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.
