tag:blogger.com,1999:blog-12467669.post7630936546034161732..comments2023-04-29T07:23:25.825-04:00Comments on Jay Fields' Thoughts: Avoiding costly typosJayhttp://www.blogger.com/profile/14491442812573747680noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-12467669.post-17027113356227612732007-12-22T15:17:00.000-05:002007-12-22T15:17:00.000-05:00My perl knowledge is nil, but I don't believe Ruby...My perl knowledge is nil, but I don't believe Ruby has something similar.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12467669.post-32078127087458894052007-12-22T14:16:00.000-05:002007-12-22T14:16:00.000-05:00Does Ruby have anything similar to Perl's strictur...Does Ruby have anything similar to Perl's strictures & warnings?draegtunhttps://www.blogger.com/profile/05969589096618305671noreply@blogger.comtag:blogger.com,1999:blog-12467669.post-58320578763684580782007-12-21T11:16:00.000-05:002007-12-21T11:16:00.000-05:00I also prefer class methods to constants, and not ...I also prefer class methods to constants, and not only because of the naming (elephant case sucks). Thanks to the way Rails loads constants (models, &c), you can run into some real problems with ModelName::Whatever that don't appear with ModelName.whatever.Yossef Mendelssohnhttps://www.blogger.com/profile/16022423670354635743noreply@blogger.comtag:blogger.com,1999:blog-12467669.post-16616349574325610052007-12-21T10:53:00.000-05:002007-12-21T10:53:00.000-05:00I've had this exact use-case on my mind for some t...I've had this exact use-case on my mind for some time now. Glad to see it's a verified patch.Farley Knighthttps://www.blogger.com/profile/05613485191970690903noreply@blogger.comtag:blogger.com,1999:blog-12467669.post-1340182136550355472007-12-21T10:14:00.000-05:002007-12-21T10:14:00.000-05:00Ola, I thought it was going to be a pain, but ther...Ola, <BR/>I thought it was going to be a pain, but there are only 2 places in the rails codebase where "RAILS_ENV =" appears (initializer and test_help).<BR/><BR/>Cheers, JayAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-12467669.post-81667508430585543042007-12-21T06:46:00.000-05:002007-12-21T06:46:00.000-05:00Nice stuff. The last one would be good to have too...Nice stuff. The last one would be good to have too, except it might fail in interesting ways when RAILS_ENV is set from within Rails (which as far as I know is done in some places).<BR/><BR/>You would have to make sure that this code is the last to execute in Rails loading.Ola Binihttps://www.blogger.com/profile/15793488672952593953noreply@blogger.comtag:blogger.com,1999:blog-12467669.post-67035591455720808182007-12-21T02:04:00.000-05:002007-12-21T02:04:00.000-05:00One thing I got in the habit of, regardless of lan...One thing I got in the habit of, regardless of language, is to put the variable second in a comparison. For example:<BR/><BR/><B>if "string" == foo</B>, or <BR/><B>unless 3 == bar</B><BR/><BR/>This way, if I happen to only type one =, the complier or interpreter will yell at me, rather than me pulling my hair out trying to find bugs.Anonymousnoreply@blogger.com