using nested field values #41

Closed
leabdalla opened this Issue May 28, 2013 · 2 comments

Comments

Projects
None yet
4 participants

my document:

    {
       "_id": ObjectId("519733333fb6664b5d000000"),
       "email": "email@email.com",
       "dates": {
           "pre_register": "2013-05-18 04:53:38" 
       } 
    }

my model:

    class Member
        include Mongoid::Document
        store_in collection:'member'
        field :email
        field :dates
    end

how to use the field dates.pre_register? I tried this: field:dates.pre_register
but no success

what about Hash and Array fields?

Member

elia commented May 29, 2013

Is this about mongoid or activeadmin-mongoid?

If it's about activeadmin-mongoid: honestly dunno, I'd say that if you use embeds_one stuff should work

vpytak commented Sep 13, 2013

in my code I worked with Arrays and Hashes in way:

controller do
  def create
    params['hash_value'] = JSON.parse(params['hash_value'].gsub('=>',':'))
    super
  end
end

But I really hope there is some way of handling this smarter. Embedding seems like overhead.

@boie0025 boie0025 closed this Jun 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment