Sunday, 9 November 2008

Merb 1.0

So Merb 1.0 was released 2 days ago during RubyConf, just
sudo gem install merb
to update.

I had to update my config/dependencies.rb file to read
merb_gems_version = "1.0"
and also
sudo gem install webrat
, which is a Ruby Acceptance Testing plugin. Here's the Git repo if you want to check it out.

Thursday, 6 November 2008

Getting the Database name in Merb and DataMapper

After a lot of searching and banging my head against my keyboard I finally found how to get the database name for my Merb application:
Macintosh:ruby-rss-feeds marktucks$ merb -i
...
>> repository(:default).adapter
=> #, @name=:default, @transactions={}>
>> repository(:default).adapter.uri
=> #
>> repository(:default).adapter.uri.path
=> "sample_development.db" # YAY!

I'm sure there must be a better way to do this. A Rails::Configuration.database_configuration equivalent? But I just cannot find it. The
Merb.config
doesn't seem to have a database property / method. You can get stuff like the host (
Merb.config[:host]
).

Any suggestions / better solutions are welcome.