Sha256: 3393af12b9439f4e93ae092dd4c96a68eef33774c6acf05148982b883351dd40
Contents?: true
Size: 810 Bytes
Versions: 3
Compression:
Stored size: 810 Bytes
Contents
require 'raisin/routing' module ActionDispatch::Routing class Mapper def api(options, &block) return unless block_given? version = options[:version].to_s is_default = options.fetch(:default, false) raise 'Version is missing in constraint' if version.blank? @api_resources = true send(:constraints, Raisin::Routing::VersionConstraint.new(version, is_default)) do send(:scope, module: version) do yield end end ensure @api_resources = nil end def resources(*resources, &block) if @api_resources options = resources.extract_options! options[:except] ||= [] options[:except].concat([:new, :edit]) super(*resources, options) else super end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
raisin-0.1.2 | lib/raisin/rails/routes.rb |
raisin-0.1.1 | lib/raisin/rails/routes.rb |
raisin-0.1.0 | lib/raisin/rails/routes.rb |