codemilan
codemilan

Reputation: 1082

How to use existing mongodb collection in rails3.2

I have a collection in a mongodb imported from csv file, and I want to load that into my ruby-on-rails3.2.13 app to list the collections document in homepage.
I have used mongoid as an object document mapper.
Can anyone please tell me the process for this problem?

Upvotes: 3

Views: 360

Answers (1)

Muntasim
Muntasim

Reputation: 6786

it should be plain and simple if I understood your question.

say you have a model that uses mongoid

class Model
  include Mongoid::Document
  #define fields here
end

then in controller

@records = Model.all

then you should get an array of records

Upvotes: 1

Related Questions