lib/jets/router.rb in jets-0.8.14 vs lib/jets/router.rb in jets-0.8.15
- old
+ new
@@ -19,15 +19,19 @@
end
# resources macro expands to all the routes
def resources(name)
get "#{name}", to: "#{name}#index"
- get "#{name}/new", to: "#{name}#new"
+ get "#{name}/new", to: "#{name}#new" unless api_mode?
get "#{name}/:id", to: "#{name}#show"
post "#{name}", to: "#{name}#create"
- get "#{name}/:id/edit", to: "#{name}#edit"
+ get "#{name}/:id/edit", to: "#{name}#edit" unless api_mode?
put "#{name}/:id", to: "#{name}#update"
delete "#{name}/:id", to: "#{name}#delete"
+ end
+
+ def api_mode?
+ Jets.config.api_generator
end
def create_route(options)
@routes << Route.new(options)
end