On Sun, Oct 24, 2010 at 5:52 PM, DAZ <[email protected]> wrote:

> Thanks again Richard.
>
> For the time being I'm going to just use a database file, but could
> you help me out with a couple of things?
>
> 1) How do you export DM logs to the console?
>

    DataMapper.setup(:default, "sqlite3::memory:")
*    DataMapper::Logger.new(STDOUT, :debug)*



> 2) Could you give me an example of a rescue block - I'm not really
> used to using them...
>

A particularly pertinent one:

      admin = User.create(:email => '[email protected]')
      admin.admin = true
      begin
        admin.save
      rescue DataMapper::SaveFailureError => e
        LOG.error "Error saving admin user: #{e.to_s} validation:
#{admin.errors.values.join(', ')}"
      rescue StandardError => e
        LOG.error "Got an error trying to save the site admin user
#{e.to_s}"
      end

Enjoy.
-- 
http://richardconroy.blogspot.com | http://twitter.com/RichardConroy

-- 
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.

Reply via email to