next stop: semantic metaverse

Avatar

random stuff about the semantic web, mobile technology and mapping

TRE: Rails Reflection

Chad Fowler just finished his presentation on Rails Reflection, telling us how we can dynamically introspect and manipulate Rails objects and classes, such as ActiveRecord objects, routes, etc.

He also showed an app that Bruce and Chad and him developed, which basically allows them to build ActiveRecord models through a web interface (complete with on-the-fly database table generation). They ended up scrapping it because of certain problems with it (I’ll have to find out what those problems were).

One particularly interesting tip was using the Rails console for executing migration statements. It kinda goes likes this:

  1. Bring up the rails console
  2. Execute ‘irb ActiveRecord::Base.connection
  3. Now you can call migration statements as you would in the up or down methods of a migration

Another good tip was routes reflection by using this in the console:

puts ActionController::Routing::Routes.routes

Overall, a very interesting talk.

Technorati Tags: ,

One Comment, Comment or Ping

  1. Robbie Muffin

    Can you give us more details? I’d love to see more about that use of reflection!

    Regards the project … I wonder if restarting the webserver or reloading the page consecutively, were the kind of problems they were running into.

Reply to “TRE: Rails Reflection”

FOAF

Before you go

Going so soon? May these links be a guide to web enlightenment. Schwing!