Module: Pickel::ViewHelper
- Defined in:
- lib/pickel/view_helper.rb
Instance Method Summary collapse
- #form_for(record, options = {}, &block) ⇒ Object
- #form_with(model: nil, scope: nil, url: nil, format: nil, **options) ⇒ Object
Instance Method Details
#form_for(record, options = {}, &block) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/pickel/view_helper.rb', line 26 def form_for(record, = {}, &block) return super unless record.is_a?(Search) opts = .dup opts[:scope] = opts.delete(:as) opts[:local] = !(opts.delete(:remote) == true) form_with(model: record, **opts, &block) end |
#form_with(model: nil, scope: nil, url: nil, format: nil, **options) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pickel/view_helper.rb', line 13 def form_with(model: nil, scope: nil, url: nil, format: nil, **) return super unless model.is_a?(Search) url ||= polymorphic_path(model.klass, format: format) scope ||= :q [:builder] ||= FormBuilder [:id] ||= model.html_id [:class] ||= model.html_id [:method] ||= :get super(model: model, scope: scope, url: url, **) end |