On 14 May 2011 13:04, comopasta Gr <li...@ruby-forum.com> wrote:
> Hi,
>
> So far I've let Rails and ActiveRecord rule the game. But I think
> there's some things I should change.
>
> I have a record (called Tag) that is searched by using the default auto
> incrementable Id that AR provides. On the Tag record I also keep a
> unique identifier which is a string of 13 characters. That identifier is
> really the Tag.
>
> So my doubts are:
> - Should I set the custom identifier as the primary key and remove the
> default id?

No

> - Or should I keep the default Id but instead fill it with the custom
> identifier?

No

> - Would it make any difference when thinking of performance?

I doubt it.

>
> I'm currently adding some statistics record for each of those Tags. So
> one tag "has_many" statistic records. And this statistics record has the
> Tag identifier stored.

Why store the tag identifier in the statistic?  You have the tag_id
presumably.  If you need to show the tag itself it is
statistic.tag.identifier or whatever it is called.

Colin

> That's when I thought that the common key to tie
> them together should be the custom identifier instead of the default id.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to