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
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 someone help with this, please?
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?
So what happens? Does Test.all return the record in question?
So I heard a million of tutorials and still nothing. Everything I’ve the
right set up, but the printing dates from collection I can’t to get…
For example, my setup is the same as here
(http://blog.futureshock-ed.com/2010/07/mongomapper-with-rails-3.html),
data in my database are saved (I see that via console), but through the
script is not possible to show that…
No message, no error, nothing…
Do you everybody some idea, what would be wrong? It makes me crazy…
On Mar 6, 1:45am, Manny 777 [email protected] wrote:
So at the rails console, what does Test.all returns? is your record
actually in the right database/collection?
Fred
Hmm…maybe here could be the problem, because I don’t know, how to
specific collection, from which I want to showing dates…
Current situation:
controller
class TestController < ApplicationController
def index
@tests=Testt.all
end
end
model
class Testt
include MongoMapper::Document
key :name, String
end
mongo.rb
MongoMapper.database = “mydb”
And the dates are stored in “mydb” database in a collection called
“people”. And if I see on my code, I am not see the setup of collection
“people”, where are stored dates… So the problem could be perhaps
here… but in tutorials I am not see specific the collection, from they
show data…
Or the names of models, controllers and the collections must be the
same?
Or the names of models, controllers and the collections must be the
same?
If the model is called Testt then mongomapper will assume that the
collection is called testt (although I’m sure there is a way to
override that), much like how activerecord derives the table name from
the class name
If you renamed your class to Person, mongomapper should use the people
collection automatically. Controller name is unimportant
So I heard a million of tutorials and still nothing. Everything I’ve the
right set up, but the printing dates from collection I can’t to get…
For example, my setup is the same as here
(http://blog.futureshock-ed.com/2010/07/mongomapper-with-rails-3.html),
data in my database are saved (I see that via console), but through the
script is not possible to show that…
So at the rails console, what does Test.all returns? is your record
actually in the right database/collection?