On 21 October 2010 07:10, Rahul J. [email protected] wrote:
I don’t mind your comment, but appreciate you for explaining me.
Which comment? You have not quoted the email so I have to guess what
you are talking about.
Actually, its the first time i am using scripting language for my
purpose and i am use to of having only needful info. In terms of
complexity, there is no difference, as in both of cases (manual join or
associations), things will be same. But only thing that i was refusing
is fetching whole 500 users records, while i am needing only one field
of that record.
Do you need one field from all 500 records? If so then the overhead
of fetching all fields is trivial. If you mean that you only need
data from a few of the records then this is not a problem, the
individual user records will only be fetched if you access
Generally a programming language is supposed to provide platform over
which you can build your functionality. But scripting language is
providing a part of the functionality and you have to build your own
over that, instead you doing everything from scratch.
After learning ruby & rails more and more, i found that the best is to
go with the defaults/functionality provided by the language.
Definitely, Rails is all about providing easy ways of doing things,
but to make use of those you must accept the Rails way of doing
things. It is possible to do things other ways but it may not be easy
and there is little point in using Rails if you do not do things the
Rails way. So in this case use associations and accept the trivial
overheads. Later on if it becomes clear that the overheads are
slowing your application down then is the time to optimise the code.