Sha256: 4e82ac5ceb666737a6361c2a5270caf71d5403bd806c04a9682aa03fc972188e
Contents?: true
Size: 600 Bytes
Versions: 2
Compression:
Stored size: 600 Bytes
Contents
module RailsCom::Routes extend self def routes_wrapper ary = [] routes.each do |route| ary << detail(route) end ary end def actions(controller) routes_wrapper.select { |i| i[:controller] == controller.to_s }.map { |i| i[:action] }.uniq end private def detail(route) wrap = ActionDispatch::Routing::RouteWrapper.new(route) info = route.defaults { verb: route.verb, path: wrap.path, controller: info[:controller], action: info[:action] } end def routes @routes ||= Rails.application.routes.routes end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails_com-1.1.0 | lib/rails_com/routes.rb |
rails_com-1.0.0 | lib/rails_com/routes.rb |