Sha256: 14649647a2b7b7c921eeb166baed790e1738e173004d0bc8756fe70ec9ffb0a5
Contents?: true
Size: 999 Bytes
Versions: 3
Compression:
Stored size: 999 Bytes
Contents
module PageletRails::Concerns::Routes extend ActiveSupport::Concern module ClassMethods # Define routes inline in controller # # pagelet_routes do # resources :users # end # def pagelet_routes &block @pagelet_routes << block end def pagelet_resources *args, &block controller_name = self.controller_name @pagelet_routes << Proc.new do resources controller_name, *args, &block end end def pagelet_resource *args, &block controller_name = self.controller_name opts = args.extract_options! opts[:controller] ||= controller_name @pagelet_routes << Proc.new do resource controller_name, *args, opts, &block end end def load_pagelet_routes! context @pagelet_routes.each do |proc| context.instance_eval(&proc) end end def inherited subklass subklass.instance_variable_set(:@pagelet_routes, []) super end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pagelet_rails-0.1.4 | lib/pagelet_rails/concerns/routes.rb |
pagelet_rails-0.1.3 | lib/pagelet_rails/concerns/routes.rb |
pagelet_rails-0.1.2 | lib/pagelet_rails/concerns/routes.rb |