lib/auth/rails/routes.rb in wordjelly-auth-1.5.8 vs lib/auth/rails/routes.rb in wordjelly-auth-1.5.9
- old
+ new
@@ -1,23 +1,17 @@
module ActionDispatch::Routing
class Mapper
-
-
def get_scope(model)
scope_path = "/"
- ## here there is the problem of repeats
- ## because we have the model class as
- ## so how to split that for the scope
- ## normally i had shopping/payments/
- #puts Auth.configuration.send("#{model}_class").underscore.pluralize.to_s
-
+
Auth.configuration.send("#{model}_class").underscore.pluralize.scan(/(?<scope_path>.+?)\/(?<collection>[A-Za-z_]+)$/) do
if Regexp.last_match[:scope_path]
scope_path = scope_path + Regexp.last_match[:scope_path]
end
end
+ #first run cyclically and check if the things change.
#puts "scope path is: #{scope_path}"
scope_path
end
@@ -31,10 +25,18 @@
as_prefix
#Auth.configuration.send("#{model}_class").underscore.pluralize.gsub("\/","_")
end
+ ## now what flashing?
+ ## or what ?
+ ## a spec?
+ ## okay let me add the images
+ ## keep making progress
+ ## and then we test it later.
+ ## let me write flashing.
+
def get_collection(model)
collection = nil
Auth.configuration.send("#{model}_class").underscore.pluralize.scan(/(?<scope_path>.+?)\/(?<collection>[A-Za-z_]+)$/) do
collection = Regexp.last_match[:collection]
end
@@ -44,11 +46,9 @@
## the default is
def get_controller(model)
Auth.configuration.send("#{model}_controller")
end
-
-
##@param app_route_resources[Hash] ->
##key:resource[String] -> the name of the resource for which omniauth routes are to be generated.
##value:opts[Hash] -> the options specifying the views, controllers etc for omniauth.
##expected to be present in the preinitializer in the routes of the target app.