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:
- Bring up the rails console
- Execute ‘irb ActiveRecord::Base.connection‘
- 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: rails, therailsedge



One Comment, Comment or Ping
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.
Jan 19th, 2007
Reply to “TRE: Rails Reflection”