damianham wrote:
[...]
>
> If the 'folder.files' element was an array of ids then there would be
> no subsequent database access to determine the size() value.
Not really true; it takes a query in either case. Your method still
needs "SELECT file_ids FROM folders WHERE id = ?". That's not rea
Performance.
Lets, say you are listing a set of folders on a page and you want to
display the number of files in each folder. So you would use
something like
<%= folder.files.size() %>
With the classic foreign key relation then for every folder you will
get an SQL query like "select count(file
You could possibly do this, but why would you want to?
You'll probably want to look into the ActiveRecord docs related to
virtual attributes, and possibly serialized fields.
But again, WHY? The foreign key -> parent relation is practically as
old as databases, and going against that current is o
On Fri, Mar 27, 2009 at 4:33 PM, Paul A.
wrote:
>
> Hi,
>
> I would like to make a relation using a different way then the classic
> belongs_to/has_many association. Instead of this, I would like to save
> the foreign key in the parent class as a list of ids.
>
> For instance, we can consider 2 m
4 matches
Mail list logo