CrudVision - Lisa Seelye

June 23, 2007

Why CRUD? - Part 1

Filed under: crud, rails — Lisa Seelye @ 16:30

To preface: I'm going to talk a lot about my pet project, evedb.info, which is a fansite for Eve Online which seems to be stuck in a perpetual development phase. The site was written in rails as a learning project.

Like many other web developers that use a MVC model of coding I thought the pinacle of design (and by "design" I mean code design and URL presentation) was to have a ViewController that would display Agents, the Corporations to which an Agent belongs, the Stations that a Corporation owns, the Systems in which the Stations are and the Items available in the game and so forth. This meant my ViewController had a bunch of methods: agents, corporations, stations, systems, items and so forth. The URL looks like /view/agents/[name of agent]. Station names are very long so I used their id instead of their name.

When I migrated to Rails 1.2 I had a problem. Since my URLs included the names of the thing being viewed (/view/agents/Hoken+Isikesu and /view/items/Dragon+F.O.F.+Cruise+Missile+I) sometimes included a period (.). When Rails 1.2 came about it introduced the respond_to method that can be used to handle requests for different types of representations for the same data:

RUBY:
  1. respond_to do |format|
  2. format.html
  3. format.js
  4. end

So /views/agents/1 will default to the HTML format and 1.xml will want the XML format.

So now the URL that looks like: /view/items/Dragon+F.O.F.+Cruise+Missile+I will want the /view/items/Dragon+F resource with the O.F.+Cruise+Missile+I format. Ooops. Bug!

And so it begins

Filed under: blog, england, life, php, rails, uk — Lisa Seelye @ 02:17

My name is Lisa Seelye and I'm a Ruby on Rails developer. That is to say I use Rails in my hobbies as well as professionally. I've been using it since May 2006 and have loved it since.

Prior to using Ruby and Rails I came from a PHP background (the astute observer will note that my site uses PHP) and before that Perl.

I live in the United Kingdom (by way of the United States) and work in Leeds, England. I love my job and the chance to use Rails is really nifty!

So yeah... I'm hoping to use this space to write about Ruby, Rails and other things.

The name of this domain name is shamelessly stolen from DHH's keynote from Railsconf 2006. I happen to appreciate the CRUD way and REST so I appreciate David's "crudvision".

Hello, World.

Powered by WordPress