Rails 3 and ActiveModel

45 views
Skip to first unread message

Ruben Fonseca

unread,
Feb 19, 2010, 5:50:53 AM2/19/10
Hi @all!

I want to start a new pet project and use the latest technology out there. For me it means Rails 3 and MongoMapper.

I’ve been trying to use the rails 3 fork which supports activemodel. However I’m suffering from severe lack of documentation.

I has able to setup the project, but now I have some questions: does the rails 3 fork supports generations? I tried to put “g.orm :mongo_mapper” and “g.orm :mongomapper” without any success (it always complains that it doesn’t know the ORM).

Any example out there using the rails 3 fork? Thank you for your help!

Ruben

Jacques Crocker

unread,
Feb 19, 2010, 10:45:24 AM2/19/10
Hi Ruben. I'm still working on getting the new generators integrated into my fork of MongoMapper at http://github.com/merbjedi/mongomapper. I'll mainly be using the ones taken from here: http://github.com/indirect/rails3-generators

If you're using MongoMapper, you'll sort of have to get used to the lack of documentation. I tend to have the MongoMapper library tests open in an editor at all times so I can quickly search through them for code examples. The switch to ActiveModel could potentially remove the need to document a huge chunk of functionality (like validations) since you'll be able to use a lot of the core rails docs which seems to be extremely well maintained as of late.

Really though, MongoMapper isn't a terribly complex library. Codebase is well organized and fairly easy to understand. The biggest learning curve I had to overcome was just MongoDB itself and its ruby interface. And for that 10gen has pretty excellent docs. http://www.mongodb.org/display/DOCS/Ruby+Tutorial

I'd recommend getting as familiar as possible with the MongoDB commands and the ruby driver. It makes looking into the mongomapper internals and getting it to do what you need it to do much much easier.

Best of luck

> --
> You received this message because you are subscribed to the Google
> Groups "MongoMapper" group.
> For more options, visit this group at
> http://groups.google.com/group/mongomapper?hl=en?hl=en

John Nunemaker

unread,
Feb 19, 2010, 11:00:57 AM2/19/10
Great answer Jacques.

Kyle Banker

unread,
Feb 19, 2010, 11:02:41 AM2/19/10
I second that, John. Good advice, Jacques.

Ruben Fonseca

unread,
Feb 19, 2010, 6:30:43 PM2/19/10
Hi Jackes!

On Feb 19, 2010, at 3:45 PM, Jacques Crocker wrote:

> Hi Ruben. I'm still working on getting the new generators integrated into my fork of MongoMapper at http://github.com/merbjedi/mongomapper. I'll mainly be using the ones taken from here: http://github.com/indirect/rails3-generators
>
> If you're using MongoMapper, you'll sort of have to get used to the lack of documentation. I tend to have the MongoMapper library tests open in an editor at all times so I can quickly search through them for code examples.

This is always a good advice, and after reading your email and opening mongomapper test suite, it was really a blessing :)

Thank you for your time and help, and keep up the good work!! I will keep a close watch on the rails 3 branch :)

Ruben

Eric Raslich

unread,
Mar 6, 2010, 11:28:41 AM3/6/10
to MongoMapper
On Feb 19, 10:45 am, Jacques Crocker <[email protected]> wrote:
> Hi Ruben. I'm still working on getting the new generators integrated into my fork of MongoMapper athttp://github.com/merbjedi/mongomapper. I'll mainly be using the ones taken from here:http://github.com/indirect/rails3-generators
>

I saw how to get the merbjedi mongomapper working, how do I install
your generators, Jacques?

Jacques Crocker

unread,
Mar 6, 2010, 5:36:50 PM3/6/10
Sorry, haven't integrated them yet. You might be able to install them directly from the instructions here: http://github.com/indirect/rails3-generators

I still need to dive into the new generators in Rails3. Haven't wrapped my head around it quite yet.

Anuj Dutta

unread,
Mar 6, 2010, 5:49:09 PM3/6/10
On 7 March 2010 04:06, Jacques Crocker <[email protected]> wrote:
Sorry, haven't integrated them yet. You might be able to install them directly from the instructions here: http://github.com/indirect/rails3-generators

I still need to dive into the new generators in Rails3. Haven't wrapped my head around it quite yet.



Hello Jacques,

What generators are there for mongomapper? I can't see any in your fork or main mongomapper repository.

Anuj

 
On Mar 6, 2010, at 8:28 AM, Eric Raslich wrote:

> On Feb 19, 10:45 am, Jacques Crocker <[email protected]> wrote:
>> Hi Ruben. I'm still working on getting the new generators integrated into my fork of MongoMapper athttp://github.com/merbjedi/mongomapper. I'll mainly be using the ones taken from here:http://github.com/indirect/rails3-generators
>>
>
> I saw how to get the merbjedi mongomapper working, how do I install
> your generators, Jacques?
>
> --
> You received this message because you are subscribed to the Google
> Groups "MongoMapper" group.
> For more options, visit this group at
> http://groups.google.com/group/mongomapper?hl=en?hl=en

--
You received this message because you are subscribed to the Google
Groups "MongoMapper" group.
For more options, visit this group at
http://groups.google.com/group/mongomapper?hl=en?hl=en



--
Anuj DUTTA

Jacques Crocker

unread,
Mar 6, 2010, 6:00:54 PM3/6/10
None yet. There are only one in the indirect repository. Really, all its doing is generating a file with the content:

class ModelName
  include MongoMapper::Document 
 
  key :key, String                  
  
  timestamps!
  
  # Validations :::::::::::::::::::::::::::::::::::::::::::::::::::::
  # validates_presence_of :attribute
 
  # Assocations :::::::::::::::::::::::::::::::::::::::::::::::::::::
  # belongs_to :model
  # many :model
  # one :model
  
  # Callbacks ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
  # before_craete :your_model_method
  # after_create :your_model_method
  # before_upate :your_model_method
  
end

Anuj Dutta

unread,
Mar 6, 2010, 6:31:02 PM3/6/10
On 7 March 2010 04:30, Jacques Crocker <[email protected]> wrote:
None yet. There are only one in the indirect repository. Really, all its doing is generating a file with the content:

class ModelName
  include MongoMapper::Document 
 
  key :key, String                  
  
  timestamps!
  
  # Validations :::::::::::::::::::::::::::::::::::::::::::::::::::::
  # validates_presence_of :attribute
 
  # Assocations :::::::::::::::::::::::::::::::::::::::::::::::::::::
  # belongs_to :model
  # many :model
  # one :model
  
  # Callbacks ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
  # before_craete :your_model_method
  # after_create :your_model_method
  # before_upate :your_model_method
  
end



I saw that as I have been using the master repository for some Rails3 development. Does it need any more generators?

Anuj
 



--
Anuj DUTTA

Sho Fukamachi

unread,
Mar 6, 2010, 8:57:51 PM3/6/10
If that's the actual code, might want to correct the example callbacks before_create and before_update ..
Reply all
Reply to author
Forward
0 new messages