rod mclaughlin


My first Ruby Gem - 'Routesfordummies' (30 sep 12)

A demonstration of my new gem is at rockonruby.com. This site is Rails 4, but I've tested the gem on 3.2.too.

 

Why I wrote 'routesfordummies':

I find routes.rb one of the most puzzling aspects of Ruby on Rails.

It used to say things like 

 map.connect 'orders', :controller => 'orders', :action => 'index' 

Then it changed to

 get 'orders/index => 'orders#index' 

with much fanfare about how much easier and safer this is.

I don't get it. 

So I've created a gem to make routes.rb easier for dummies.

Gemfile:

  gem 'routesfordummies', github: 'pdxrod/routesfordummies'

 

I relied on this intro to creating gems at 

http://namick.tumblr.com/post/17663752365/how-to-create-a-gemified-plugin-with-rails-3-2-rspec

I'm grateful to Nathan Amick for writing this introduction, but I must admit, I followed it mindlessly, without knowing what half of it means. It's written in the usual style of Rails documentation - the explanation needs explaining:

"Now lets change back to the root directory of the 
plugin and set up Spork. Check out the Guardfile, 
it is important that  the spork block
come before the rspec."
 $ bundle exec guard

whatever that is, it runs for ever. I guess it's continuous integration.

 

 

 



Back
Portland London