The Scoop

  • Home
  • Projects
  • About The Scoop
  • Fixing Journalism
  • Medill Links
  • Departments
    • API
    • Apple
    • Asides
    • Broadcast
    • Campaign Finance
    • Car Tools
    • Code
    • Data
    • DIY
    • django
    • Fed Data
    • FOIA
    • General
    • IRE
    • Journalism
    • Local Data
    • Mapping
    • Miscellany
    • NonGov Data
    • Online
    • Paper Trail
    • Presentations
    • Public Records
    • Python
    • Rails
    • Ruby
    • SLA
    • Social Network Analysis
    • Sports
    • State Data
    • Teaching
    • Work
    • XML
  • Subscribe via RSS

Starting with Rails

January 11th, 2008  |  Published in Rails  |  4 Comments

So as part of my new job I’m learning to use Rails, and by extension, the Ruby language. Both have been easier to pick up, at least initially, then I had expected. For that, I’m sure I have my experiences with Python and Django to thank: many concepts are similar, with sometimes similar syntax.

I started out by reading a book on Active Record, which is the ORM for Rails, and I would suggest that to anybody coming to Rails from a database background, because that way you’re not struggling to pick up both database concepts and Rails/Ruby syntax. Migrations? Good. Rake tasks? Good. The book itself is a decent practical guide, though not perfect, and will be a useful reference for me as I progress.

A very helpful book for me has been David Black’s “Ruby for Rails”, which is a great guide to syntax and concepts for people like me who are new to these things. On many levels, Ruby is elegant and makes a great deal of sense.

The other resource that I couldn’t do without is my colleagues, all of whom are much better-versed in Ruby and Rails than I am. Learning this in isolation would be a much greater challenge.

I’ve got a lingering preference for the url layout of Django, which allows uses regular expressions to construct any kind of url I’d like, and I’m sure I’ll get more comfortable with Rails’ routing and controller syntax as I get further into those areas. And yes, there is that magic, too, which has its ups and downs. Suffice to say that I’ll still be using Django for personal stuff, but you’ll see me experiment with Rails outside work as well.

In December I was in New York and went with one of the nytimes.com developers to the RubyNYC meeting, where features of Rails 2 were being discussed. It was an interesting presentation – much of it over my head – but one of the points that grabbed my attention was a brief discussion of the use of slugs in Rails. Slugs? Where have I heard that before? Nice to see a newspaper term work its way further into the Web.

Responses

Feed Trackback Address
  1. Peter Harkins says:

    January 11th, 2008 at 10:06 pm (#)

    Heh, slugs are important. The rails default routing puts your objects’ ids in the URL. Ugh. I don’t want my sites to advertise how many of each object I have, or allow some bored coder to hammer on my server because he feels like scraping them all. It’s easy enough to fix with to_param on the model, at least.

  2. Aron Pilhofer says:

    January 13th, 2008 at 4:25 pm (#)

    Peter,

    In Rails 2.0, routing allows you to design whatever routes you want, and no longer ties your objects to a specific URL. I’m honestly not sure about pre-2.0.

  3. Simon Willison says:

    January 18th, 2008 at 5:28 pm (#)

    I haven’t read it myself, but I keep on hearing that “The Rails Way” is head and shoulders above the other Rails books.

  4. Derek says:

    January 19th, 2008 at 9:02 am (#)

    My new boss (that’s Aron from above) recommended it as well, and it’s sitting on my nightstand. Hope to get to it this week.

Leave a Response

Recent Comments

  • Eric Mill on On Legislative Data Transparency
  • (19:19 06-02-2012) Noticias más populares de #opengov en las ultimas 24 horas | Tuits de Software Libre on On Legislative Data Transparency
  • (15:05 06-02-2012) Noticias más populares de #opengov en las ultimas 24 horas | Tuits de Software Libre on On Legislative Data Transparency
  • (02:33 06-02-2012) Noticias más populares de #opengov en las ultimas 24 horas | Tuits de Software Libre on On Legislative Data Transparency
  • Malcolm Tredinnick on On Legislative Data Transparency

Recent Posts

  • On Legislative Data Transparency
  • What We Don’t Know About Elections
  • RemoteTable Is Your Friend
  • Measuring Vocabulary Richness (or, Trying Out Django on Heroku)
  • In Defense of Building Tools

Linking Out

  • Mapping America — Census Bureau 2005-9 American Community Survey - NYTimes.com
    holy crap
  • Backbone.js and Django | joshbohde.com
  • ProPublica
  • Geoff: GeoJSON Feature Functions for JavaScript
  • Introducing Spanner: From Documents to Linked Data Apps—Clark & Parsia: Thinking Clearly
  • A performance lesson on Django QuerySets | Seek Nuance
  • http://www.post-gazette.com/pg/03001/1108747-209.stm
  • CBC News - Canada - Database: Canadian cables in WikiLeaks
  • Federal prosecutors likely to keep jobs after cases collapse - USATODAY.com
  • Strata Gems: Explore and visualize graphs with Gephi - O'Reilly Radar


©2012 The Scoop
Powered by WordPress using the Gridline Lite theme by Graph Paper Press.