Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1029

respond_to? :scoped for has_many returns false

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.1.3
    • Affects Version/s: None
    • Component/s: None

      I have written the following in cucumber format because I believe it is more clear and to the point:

      Unable to find source-code formatter for language: cucumber. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      Scenario: has many relationship responds to scoped
        Given a category
        And category has_many dialogs
        When I ask if category.dialogs responds to :scoped
        Then it returns true
      
      Scenario: has many scoped is a scope
        Given a category
        And category has_many dialogs
        When I get category.dialogs.scoped
        Then it returns the scope (?)
      

      I do not believe these scenarios are the current implementation. category.dialogs.scoped does return a hash with the scoped conditions (not scope object), however category.dialogs.respond_to?(:scoped) returns false:

      category.dialogs.scoped
      > {:where=>{"category_id"=>BSON::ObjectId('4e09d3a075f5714cf3000001')}}
      category.dialogs.respond_to? :scoped
      > false
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            coffeencoke Matt Simpson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: