In Rails 5+ controller parameters are an ActionController::Parameters object. This applies to all nested hashes and not only the top level key-value pairs (I think this last part is new to Rails 5 compared to 4). So if you want to pass some parameters into a cell, which happens to call url_for with these parameters, it fails because of the case block here:
|
case options |
|
when nil |
|
_routes.url_for(url_options.symbolize_keys) |
|
when Hash |
|
_routes.url_for(options.symbolize_keys.reverse_merge!(url_options)) |
|
when String |
|
options |
|
when Array |
|
polymorphic_url(options, options.extract_options!) |
|
else |
|
polymorphic_url(options) |
|
end |
does not handle ActionController::Parameters. A workaround is to call to_h on the parameter object, however it would be great if cells-rails handled it properly. Note that we can't add ActionController::Parameters next to Hash because it symbolize_keys has been deprecated in 5.0 and removed in a later version. It needs another when block which should call to_h.
A use case for the above is if you have a cell which needs to create URLs for sorting purposes (e.g. a table). In this case, you need to have the existing parameters in order to create the URLs for say, the links in the table header.
In Rails 5+ controller parameters are an
ActionController::Parametersobject. This applies to all nested hashes and not only the top level key-value pairs (I think this last part is new to Rails 5 compared to 4). So if you want to pass some parameters into a cell, which happens to call url_for with these parameters, it fails because of thecaseblock here:cells-rails/lib/cell/rails.rb
Lines 110 to 121 in 9f2c060
does not handle
ActionController::Parameters. A workaround is to callto_hon the parameter object, however it would be great if cells-rails handled it properly. Note that we can't addActionController::Parametersnext toHashbecause itsymbolize_keyshas been deprecated in 5.0 and removed in a later version. It needs anotherwhenblock which should callto_h.A use case for the above is if you have a cell which needs to create URLs for sorting purposes (e.g. a table). In this case, you need to have the existing parameters in order to create the URLs for say, the links in the table header.