I have this in models_name:
model_names = Object.constants.collect { |sym| Object.const_get(sym) }.select { |constant| constant.class == Class && constant.include?(Mongoid::Document) }.collect { |klass| klass.name }
the result is:
["Model_name1","Model_name2","Model_name3"]
I need something like:
[{"Model1":"Count"},{"Model2":"Count"},{"Model3":"Count"}]
I need show in a chart all models and object counter inside each model is working with morris.js
You can see the example:
http://jsbin.com/uzosiq/2/embed?javascript,live
Thank you very much!
that last one:
rewrite it as
this should return an array of arrays of 2 elements (classname and count). If the variable to which this is assigned is called a, just do this:
now you have a hash at your disposal. Now you can do this:
and now you have an array of hashes of only one key-value assoc each. Which I think it is what you want.