SitePoint Sponsor

User Tag List

Results 1 to 21 of 21

Thread: Gotchas

Threaded View

  1. #1
    SitePoint Evangelist
    Join Date
    Feb 2006
    Worcs. UK
    0 Post(s)
    0 Thread(s)


    Ruby on Rails is a fabulous frame work. However, I have been surprised by a couple of gotchas:

    Development log files can get very big very quickly
    I didn't notice this until I copied a development framework to a production server and suddenly lost a lot of disk space. The development.log file was over a gig. Of course, I should have been more careful with what I copied over but I wasn't..

    YAML files don't like tabs
    When I first started working with Rails, I was using an editor that put tabs in when I indented content. No problem until I started editing database.yml and got lots of strange errors. It took me a while to track down the problem.

    I now set up editors to only enter spaces.

    Ruby isn't very clever with dates
    I've found you have to be very cautious with dates. It doesn't help that Ruby has two data types (Time and Date) that do similar things, but are different. I try to use Datetime everywhere, but still get the odd surprise.

    Rail's handling of months isn't too clever either. 3.months.ago doesn't actually take you back three months but rather 3 times 30 days. That's well documented, but can catch out the unwary (ok - I mean it caught me out). Also worth pointing out that what Rails actually does is subtract 30 times the number of seconds in a day, from the current Time to go back one "month".

    Dividing an integer by an integer returns an integer
    1/2 = 0
    My more experienced programmings friend say "of course it does", but it caught me out. The solution:
    1.0/2.0 = 0.5

    Having said all that, otherwise developing using Ruby on Rails has been a joy. I love it.

    Any other gotchas out there that I've yet to find?
    Last edited by ReggieB; Apr 18, 2006 at 08:58.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts