heartcombo / simple_form

Forms made easy for Rails! It's tied to a simple DSL, with no opinion on markup.
http://blog.plataformatec.com.br/tag/simple_form
MIT License
8.22k stars 1.32k forks source link

Invalid or incomplete POST params => ActionController::RoutingError #1706

Closed Tioneb12 closed 2 years ago

Tioneb12 commented 4 years ago

Environment

Current behavior

I have scopes in my model :

scope :animals, -> { where(type_service: 'animals') }
scope :active, -> { where(active: true) }

The form return an error : Invalid or incomplete POST params and a RoutingError

doesn't works with radio_buttons & check_boxes

<%= poi.association :services, :as => :radio_buttons, :collection => Service.options_sheets %>
<%= poi.association :services, :as => :check_boxes, :collection => Service.animals.active %>

works with radio_buttons or check_boxes for the two fields

<%= poi.association :services, :as => :radio_buttons, :collection => Service.options_sheets %>
<%= poi.association :services, :as => :radio_buttons, :collection => Service.animals.active %>

works

<%= poi.association :services, :as => :check_boxes, :collection => Service.options_sheets %>
<%= poi.association :services, :as => :check_boxes, :collection => Service.animals.active %>

doesn't works with select and check_boxes

<%= poi.association :services, :as => :select, :collection => Service.options_sheets %>
<%= poi.association :services, :as => :check_boxes, :collection => Service.animals.active %>

but works with the reverse

<%= poi.association :services, :as => :check_boxes, :collection => Service.options_sheets %>
<%= poi.association :services, :as => :select, :collection => Service.animals.active %>
ramaboo commented 2 years ago

I am seeing the same thing with a similar setup. Any idea what the root cause might be?

nashby commented 2 years ago

Hey! I'm closing this for now since there's no an easy way of reproducing it without simple app. Feel free to submit it so we can investigate.