Hi Tanin,
What Ohm does is lazy-load all attributes, it's a decision that makes
sense for most cases, since it's so rare that you
actually want to load _every single attribute_ for a model.
Hence the answer is: Don't split the body / title because you're
afraid it will get slow. If you don't access the body, it
won't ever get fetched.
Cyx
On Jun 30, 5:50 pm, Carlo Pecchia <
c.pecc...@gmail.com> wrote:
> Maybe - I repeat "maybe" - you can add an index on :title attribute...
>
> 2011/6/30 tanin can mend your broken heart <
tani...@gmail.com>:
>
>
>
>
>
>
>
>
>
> > I'm afraid that when I query 800 records only for their titles, it would
> > waste time copying content.
>
> > On Thu, Jun 30, 2011 at 1:31 PM, Carlo Pecchia <
c.pecc...@gmail.com> wrote:
>
> >> The article body lines only inside an article, right?
> >> If so... why keep them separated?
>
> >> 2011/6/29 tanin <
tani...@gmail.com>:
> >> > I have done:
>
> >> > class Article
> >> > attribute :title
> >> > reference :article_body, ArticleBody
> >> > end
>
> >> > class ArticleBody
> >> > attribute :content
> >> > reference :article, Article
> >> > end
>
> >> > But it does not make much sense because when creating, I have to:
>
> >> > a = Article.new
> >> > a.title = "this is title"
> >> > a.save
>
> >> > b = ArticleBody.new
> >> > b.content = "this is content"
> >> > b.article = a
> >> > b.save
>
> >> > a.article_body = b
> >> > a.save
>
> >> > Does anyone have a better idea?
>
> >> --
> >> Carlo Pecchia
> >> email:
c.pecc...@gmail.com
> >> twitter: @carlopecchia
>
> > --
> > Tanin Na Nakorn
> > Chief Technology Officer - Whowish Ltd.
> >
www.whowish.com
>
> --
> Carlo Pecchia
> email:
c.pecc...@gmail.com
> twitter: @carlopecchia