------art_59569_11007606.1157074890927
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Why not, if rails would have been coded to have proper prefixes in the
classes/modules, I would have avoided that trouble?



On 9/1/06, Logan Capaldo <logancapaldo / gmail.com> wrote:
>
>
> On Aug 31, 2006, at 9:03 PM, Hemant . wrote:
>
> > Recently while coding in rails, i had a column called in one of the
> > tables
> > and hence was wrapped up by ActiveRecord.
> > Guess, what it broke entire of the code, because quote is a already
> > defined
> > method somewhere in rails. I had trouble in finding out the root of
> > the
> > problem.
> >
> > Another example, as a newbie to ruby and rails I was using
> > login_engine in
> > my rails code. I have a table called messages in my database. Now,
> > login_engine controller code is like this:
> >
> [snip code]
> > Guess, what User.transaction was behaving oddly because it was
> > throwing
> > warning "Messages already defined constant". The error was shown in
> > web
> > server logs and hence again was a little difficult to track.
> >
> > Now, how as a new guy to ruby and rails, how do i know , i
> > shouldn't have a
> > column called quote and i shouldn't have a table called messages.
> >
> > I am a Qt/C++ programmer also, and the namespace issue is mostly
> > non-existent there.First of all, its because all the Qt classes
> > begin with Q
> > and hence you know.But Ruby library authors seems a little lax on
> > this, and
> > open classes make the entire thing a little nifty and difficult to
> > debug if
> > you are caught on the wrong foot.Either library authors should avoid
> > writting classes like Messages or ruby should give option of
> > importing only
> > certain methods from a module.
> > Something like:
> >
> > using std::cout;
> >
> >
> >
> > But still i am new to ruby(3 months precisely), so if you wish you
> > can take
> > my assertions with a grain of salt.
>
> This is in some ways more of a Rails problem than ruby problem and
> involves the way rails works, with you inheriting from Rails'
> classes. That particular problem would actually not be solved by C++
> style namespaces or even Q-prefixes. A potential solution to the
> problems you've experienced are the idea of selector namespaces which
> have been tossed around on the ML before.
>
>

------art_59569_11007606.1157074890927--