Shadab Ahmed
2014-Jan-06 06:35 UTC
Feature Request - Method to differentiate between a NullRelation and Actual Relation ?
Hey, I am passing a relation to a method. When the relation has been called with the *none *method, I want to do something else than usual flow. This is what I have to detect the NullRelation:> User.where(id: 1).extending_values.include?(ActiveRecord::NullRelation)=> false > User.where(id: 1).none.extending_values.include?(ActiveRecord::NullRelation)=> trueCan we have a method on ActiveRecord::Base or any other suitable module, which can tell me if the relation is null without the above hack ? Thanks, Shadab P.S. My first post in this email chain. Feel free to ridicule me if i broke any rules -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.