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

embeds_many :order by Boolean attr

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

      I have the following relationship in my Circuit Model:

      class Circuit
          include Mongoid::Document
          field :name
          embeds_many :buses, :order => [[:saturday,:asc],[:departure_time,:asc], [:number,:asc]]
      end
      

      :saturday is a Boolean, and I get this error:

      undefined method `*' for nil:NilClass

      What is funny is that when I change to :asc

      Unable to find source-code formatter for language: embeds_many. 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
       :buses, :order => [[:saturday,:asc],[:departure_time,:asc], [:number,:asc]]

      I get this:

      comparison of Array with Array failed

      It's possible to order an association from a Boolean attr?

      Thank you.

            Assignee:
            durran Durran Jordan
            Reporter:
            juanpujol juanpujol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: