06
Apr
Rails: find controller for a path
Huh, seems simple to do :p, but I’ve been seeking for a while to find the answer and dig into rails code to find a simple method to retrieve the controller of a given path (could be useful to build a navigation). There it is:
ActionController::Routing::Routes.recognize_path(path)[:controller]
13
Apr
How to create a plugin
Create a plugin on rails is the best way to share a features or a code between applications and with others. I found a lot information about how to extend or mixin ActiveRecord, but no information about how to provide a piece of application. Maybe I do wrong but that’s how I did: