Module: Tramway::FrontendHelper
- Defined in:
- app/helpers/tramway/frontend_helper.rb
Instance Method Summary collapse
Instance Method Details
#react_params(form, action, method) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/tramway/frontend_helper.rb', line 4 def react_params(form, action, method) form.properties.each_with_object({ action: react_params_url(form, action), method: method, authenticity_token: form_authenticity_token }) do |property, hash| case property[1] when :association hash.merge!( property[0] => { collection: build_collection_for_association(form, property[0]) } ) end end.merge model: form.model.attributes end |
#react_params_url(form, action) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/helpers/tramway/frontend_helper.rb', line 18 def react_params_url(form, action) case action when :create Tramway::Engine.routes.url_helpers.records_path(model: form.model.class) else Tramway::Engine.routes.url_helpers.record_path(form.model.id, model: form.model.class) end end |