Class: ActionDispatch::Routing::Mapper
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::Mapper
- Defined in:
- lib/front_end_builds/ext/routes.rb
Instance Method Summary collapse
-
#front_end(name, path = name, options = {}) ⇒ Object
Create a front end in your rails router.
Instance Method Details
#front_end(name, path = name, options = {}) ⇒ Object
Create a front end in your rails router.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/front_end_builds/ext/routes.rb', line 7 def front_end(name, path = name, = {}) defaults = { app_name: name }.merge() # Create a new build for this app. post( "#{path}" => "front_end_builds/builds#create", defaults: { app_name: name } ) # Get a build for this app. constraints FrontEndBuilds::HtmlRoutingConstraint.new do get( "/#{path}/(*path)" => "front_end_builds/bests#show", defaults: defaults ) # Need a better way to do this front_end_route = Rails.application.routes.routes.routes.find do |route| route.defaults == defaults.merge( controller: "front_end_builds/bests", action: "show" ) end FrontEndBuilds::App.register_url(name, front_end_route.format({})) end end |