Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Intresting differences between rails routing form_for helpers
# [:admin, @application] => admin_onboarding_url
# [:admin, @collections_facility] => admin_collections_facility_url
# [:admin, @application, @collections_facility] => admin_onboarding_collections_facility_url
# [:admin, :application, @collections_facility] => No route matches {:action=>"show", :application_id=>#<Collections::Facility id: 409, user_id: 1303, amount: 0.1e5, revenue_share: 0.25e1, fee: 0.31e1, created_at: "2020-01-24 10:45:50", updated_at: "2020-01-24 10:45:50", application_id: 886>, :controller=>"admin/collections/facilities"}, missing required keys: [:id]
# [:admin, :application, @application] => admin_application_onboarding_url
# format.html { redirect_to [:admin, :application, @application], notice: 'Facility was successfully created.' }
# redirect_to [:admin, :application, @collections_facility]
# => "<html><body>You are being <a href=\"http://test.host/admin/applications/233/collections/facilities/233\">redirected</a>.</body></html>"
# params
# => {"collections_facility"=><ActionController::Parameters {"amount"=>"10000", "fee"=>"3.1", "onboarding_id"=>"991", "revenue_share"=>"2.5", "user_id"=>"1412"} permitted: false>,
# "application_id"=>"991", "id"=>"233", "controller"=>"admin/collections/facilities", "action"=>"update"} permitted: false>
# [1] pry(#<Admin::Collections::FacilitiesController>)> redirect_to [:admin, :application, Onboarding.last, @collections_facility]
# NoMethodError: undefined method `admin_application_onboarding_collections_facility_url' for #<Admin::Collections::FacilitiesController:0x00007fd5f54053a8>
# [2] pry(#<Admin::Collections::FacilitiesController>)> redirect_to [:admin, Onboarding.last, @collections_facility]
# NoMethodError: undefined method `admin_onboarding_collections_facility_url' for #<Admin::Collections::FacilitiesController:0x00007fd5f54053a8>
# [3] pry(#<Admin::Collections::FacilitiesController>)> redirect_to [:admin, :application, @collections_facility]
# => "<html><body>You are being <a href=\"http://test.host/admin/applications/242/collections/facilities/242\">redirected</a>.</body></html>"
# [4] pry(#<Admin::Collections::FacilitiesController>)> @collections_facility.to_model
# => #<Collections::Facility:0x00007fd5f705bd18
# id: 242,
# user_id: 1488,
# amount: 0.1e5,
# revenue_share: 0.25e1,
# fee: 0.31e1,
# created_at: Thu, 23 Jan 2020 21:32:37 UTC +00:00,
# updated_at: Thu, 23 Jan 2020 21:32:37 UTC +00:00,
# onboarding_id: 1013>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment