We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Her proxy nil objects and we can't use &.method to protect application to raise exceptions when object is null.
For example we have 2 models Product + Brand
{ name: "Product" brand: null } class Product include Her::Model belongs_to :brand end class Brand include Her::Model end
product = Product.first product.brand == nil #=> true product.brand.__id__ == nil.__id__ #=> false product.brand&.name #=> Exception NoMethodError: undefined method `name' for nil:NilClass from /Users/madmax/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/her-1.0.3/lib/her/model/associations/association_proxy.rb:11:in `name'
For temporary solution we use .try method.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Her proxy nil objects and we can't use &.method to protect application to raise exceptions when object is null.
For example we have 2 models Product + Brand
For temporary solution we use .try method.
The text was updated successfully, but these errors were encountered: