This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SecretMethods | |
def secret_def(name, &block) | |
klass = self | |
define_method name do | |
if self.class != klass | |
raise NoMethodError | |
else | |
yield | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you want url_for(CoolProject) to give you 'cool_projects/1' but still go to ProjectsController then: | |
resources :cool_projects, :controller => :projects | |
# If you want url_for(CoolProject) to give you 'projects/1' and also go to ProjectsController then: | |
resources :cool_projects, :controller => :projects, :as => :projects | |
# If you want to reuse stuff inside resources: | |
projects_inner = lambda do | |
member do | |
resources :submodels |
NewerOlder