|Related to : new using rails 4 - ActiveModel::ForbiddenAttributesError|
|Why ActiveModel::ForbiddenAttributesError error?|
Just change the where(condition) to:
where(provider: auth.provider, uid: auth.uid)
The 1st approach fails because of the method #permitted? which AR
calls (if defined) to sanitize the attributes.
> h = auth.slice(:provider, :uid)
=> OmniAuth::AuthHash < Hashie::Mash
However, a simple Hash will not have #permitted? defined, thus it will
|How do you Skip an Object in an ActiveModel Serializer Array?|
That looks correct, try returning an array instead of a hash when you
dont want any keys. Also, I don't think calling super is necessary b/c
the filter takes in the keys.
Also, I don't think defining an attributes method is necessary.
|ActiveModel Serializer sending all records instead of specified limited amount|
Check out the guides on associations:
By default, serializers simply look up the association on the
original object. You can customize this behavior by implementing a
method with the name of the association and returning a different
So, each model gets serialized according to its serializer. Your
organization models were being put through your
OrganizationSerializer, which had has_man
|Rails, separate search function within rails form|
Add a hidden array field in the form called products. outside the form
handle products search,selection and update of that hidden field via
Check this link, Its a similar but simpler example cause he just want
to add addresses dynamically while you still have the products
searching handled via Ajax first. Please note that the only part you
need from his solution is how he updates the f
|ActiveRecord saving: differences in Rails 3.2.19 and Rails 4.2.0|
This is related with Strong Parameters which are enabled by default in
the 4.x version.
Taking the example from the documentation:
class PeopleController < ActionController::Base
# This will raise an ActiveModel::ForbiddenAttributes exception
because it's using mass assignment
# without an explicit permit step.
# This will pass with