views:

21

answers:

1

I'm writing a quick little money tracking rails app for fun that allows a user to enter their daily bills. I have a user embeds_many :bills.

I'm using Devise for auth. Here's my question. When I fetch current_user each time from my session_id, it's going to pull in my whole user and its embedded docs correct? So as bills add up, my user object will become larger and larger.

I'm wondering if there's any way I can restrict this so that my current_user find doesn't fetch the embedded docs, otherwise I don't think it makes sense to embed these bills within the user, but rather use a relationship on a separate bills collection.

Anyone have any thoughts on this?

A: 

I like the concept of having a user object that's tied to Devise, and a Profile object that defines that user's attributes and information.

So your user would have a profile, and the profile would have embedded bills.

That way you only grab the profile information when needed, which might be often, but won't be every single page load.

Jesse Wolgamott