Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/opinio/rails/routes.rb

Instance Method Summary collapse

Instance Method Details

#opinio(*args) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/opinio/rails/routes.rb', line 3

def opinio(*args)
  options       = args.extract_options!.symbolize_keys
  route_name    = options[:path_name] || Opinio.model_name.pluralize.downcase
  options[:controller] ||= 'opinio/comments'

  get "#{ route_name }(/:page)" => "#{options[:controller].to_s}#index", :as => :comments 
end

#opinio_model(*args) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/opinio/rails/routes.rb', line 11

def opinio_model(*args)
  options = args.extract_options!
  options[:controller] ||= 'opinio/comments'
  resources :comments, options do
    get 'reply', :on => :member if Opinio.accept_replies
  end
end