Open karloku opened 8 years ago
👍 I'm seeing this behaviour too. I've decided to disable validations as a result.
any solution for this , I need validation support in rails 5
Hi, I've started with making Apipie working against Rails 5 just now, should be fixed soon
@iNecas any solution ?
Solution in progress (the famous 80%-20% problem)
On 10 August 2016 at 09:52, Ratnakar notifications@github.com wrote:
@iNecas https://github.com/iNecas any solution ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Apipie/apipie-rails/issues/456#issuecomment-238791977, or mute the thread https://github.com/notifications/unsubscribe-auth/AALn64jb5QwPXvWbqJP-i_QHXdvdNUIRks5qeYMlgaJpZM4ISsgr .
@iNecas Hi, is there any work around for this issue?
I simply replaced Hash
with ActionController::Paramters
, but I hope there would be a better one :)
Changing to ActionController::Parameters
actually also prevents parameter expansion in the docs. I ended up using config.validate = :explicitly
and then:
# controller
before_action :apipie_validations, except: [:create, :update]
Not terrible IMO, especially if you also run:
# application.rb
config.action_controller.action_on_unpermitted_parameters = :raise
Looking forward to the Rails 5 release!
Changing ln 305 in validator.rb worked for me.
# return false if !value.is_a? Hash
return false if !value.respond_to? :keys
Until the gem is fixed, you can paste this into your initializer.
https://gist.github.com/pejrich/a9fd67eec3d71909deee6454c3964311
any update?
This should have been fixed
In rails 5 / ActiveSupport 5,
ActionController::Parameters
is no longer a subclass ofActiveSupport::HashWithIndifferentAccess
(see Edge Document).validator.rb#L305
It will always return false.