Giter Site home page Giter Site logo

attendance's Introduction

attendance's People

Contributors

nateberkopec avatar schneems avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

attendance's Issues

Breaks ActiveRecord::Associations::CollectionProxy objects within Pry rails console

TLDR: To duplicate the issue, start a console session using Pry as your default Rails console. Then try calling .empty? on an ActiveRecord::Associations::CollectionProxy object. You'll have to assign the object to a value, and then try calling .empty? on that value.

Possible Explanation:
Both ActiveRecord::Associations::CollectionProxy and ActiveRecord::Relation have different definitions of the empty? method, even though the former subclasses the latter.

empty? definition in ActiveRecord::Associations::CollectionProxy:

Owner: ActiveRecord::Associations::CollectionProxy
Visibility: public
Number of lines: 3

def empty?
  @association.empty?
end

empty? definition in ActiveRecord::Relation:

Owner: ActiveRecord::Relation
Visibility: public
Number of lines: 4

def empty?
  return @records.empty? if loaded?
  !exists?
end

Without Pry, in the default rails console, the alias call works correctly by aliasing blank? on both objects to the respective definitions of empty? in each class.

However, within the Pry console, the alias functionality breaks. empty? in both objects point to the definition in ActiveRecord::Relation, thus raising this error for ActiveRecord::Associations::CollectionProxy objects:

NoMethodError: undefined method `empty?' for nil:NilClass

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.