Hello there,
 I'm trying to make a simple script for statement dates from MongoDB,
but unfortunately, so far without the success result.

My Gemfile looks follow:
---------------------
require 'rubygems'
require 'mongo'
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem "mongo_mapper"
gem "rails3-generators"

in config/initializers/mongo.rb:
--------------------------
MongoMapper.connection = Mongo::Connection.new('localhost', 27017)
MongoMapper.database = "justatest-development"

if defined?(PhusionPassenger)
   PhusionPassenger.on_event(:starting_worker_process) do |forked|
     MongoMapper.connection.connect_to_master if forked
   end
end

Controller (test_controller.rb):
---------
class TestController < ApplicationController
  def index
    @xxx=Test.all
  end
end

Model (test.rb)
------------
class Test
  include MongoMapper::Document

  key :name
end

and View (index.html.erb)
--------------------
<h1>Test#index</h1>
<p>Find me in app/views/test/index.html.erb</p>

<ul>
<%@xxx.each do |ttest|%>
  <li><%=ttest.name%></li>
<%end%>
</ul>

in a MongoDB is following record:
---------------------------
{ "_id" : ObjectId("4d715abad3d8493475000003"), "name" : "John Smith" }

I don't know, what I missed, where is a bug or what is wrong... I
studied it a whole afternoon, but I can't to get the result into my view
(index.html.erb)... Can me something help with this, please?

Million times, thank you!

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to