can I get all routes in my rails application? I need an output like rake routes and put the result in an array.
Is it possible? how?
In order to spread the headache that it was to acomplish that, i did this based on @jordini answer:
Rails.application.routes.routes.to_a.each do |rota|
if rota.app.instance_variable_defined? '@defaults'
perm = Permission.where({
:acao => rota.defaults[:action],
:controller => rota.defaults[:controller],
:verbo => rota.verb.source.to_s.gsub("^","").gsub("$","").downcase
).first_or_create
end
end
This was what i've used to create all permissions for my web page at once.