exceptionz

Thoughts on Technology, Methodology and Programming.

Archive for November, 2007

Ruby, Rails, Rails Plugins, Mac OS X

Posted by Marcus Wyatt on 23 November 2007

Ruby

Rails

Rails Plugins

Mac OS X

Technorati Tags: , , ,

Powered by ScribeFire.

Posted in Mac, OS X, Rails, Rails Plugins, Ruby | 1 Comment »

Ruby, Rails, Rails Plugins, JavaScript, HTML, CSS

Posted by Marcus Wyatt on 15 November 2007

Ruby

Rails

Rails Plugins

  • Email Veracity Plugin – in addition to checking the format, the email domain is checked for MX records.

JavaScript

HTML

CSS

Technorati Tags: , , , , ,

Powered by ScribeFire.

Posted in CSS, JavaScript, Rails, Rails Plugins, Ruby | Leave a Comment »

Ruby, Rails, Rails Plugins, Mac OS X, JavaScript

Posted by Marcus Wyatt on 13 November 2007

Ruby

Rails

Rails Plugins

  • Lessjsroutes – Have you ever wanted to use named routes in your JavaScript?
  • model_stubbing – create in-memory versions of models for testing.
  • candy – a rails plugin which adds some ruby candy to your app.

Mac OS X

JavaScript

Technorati Tags: , , , ,

Powered by ScribeFire.

Posted in JavaScript, Mac, OS X, Rails, Rails Plugins, Ruby | Leave a Comment »

Ruby, Rails, TextMate, JavaScript, CSS, Web Usability, Mac OS X

Posted by Marcus Wyatt on 8 November 2007

Ruby

Rails

TextMate

JavaScript

CSS

Web Usability

Mac OS X

Technorati Tags: , , , , , ,

Powered by ScribeFire.

Posted in CSS, JavaScript, Mac, OS X, Ruby, TextMate, Web | Leave a Comment »

Ruby, JRuby, Rails, Rails Plugins, RSpec, JavaScript, CSS, SEO & Subversion

Posted by Marcus Wyatt on 7 November 2007

Ruby

JRuby

Rails

Rails Plugins

RSpec

JavaScript

CSS

SEO

Subversion

Technorati Tags: , , , , , , , ,

Powered by ScribeFire.

Posted in BDD, CSS, JavaScript, Rails, Rails Plugins, RSpec, Ruby, SEO, Subversion | Leave a Comment »

How to solve a domain object problem with Object Orientation.

Posted by Marcus Wyatt on 6 November 2007

Who cares about Domain Rules?

This article shows how you can solve a domain problem, with several different solutions. You’ll find six different solutions where I have explored each solution using exactly the same problem. I’ve always said that there is no wrong way to develop code. What do I mean by that? Well, you could solve a problem in several ways.

read more | digg story

Posted in Development, OO | Tagged: , | Leave a Comment »

Ruby, Rails, Rails Plugin

Posted by Marcus Wyatt on 6 November 2007

Ruby

Rails

Rails Plugin

Technorati Tags: , ,

Powered by ScribeFire.

Posted in Development, Rails, Rails Plugins, Ruby | Leave a Comment »

Ruby, Rails, Rails Plugin, JavaScript, CSS, TextMate

Posted by Marcus Wyatt on 5 November 2007

Ruby

Rails

Rails Plugin

JavaScript & CSS

TextMate

Technorati Tags: , , , , ,

Powered by ScribeFire.

Posted in CSS, Development, JavaScript, Rails, Rails Plugins, Ruby, TextMate | 1 Comment »

Friendly url’s in my rails application within minutes

Posted by Marcus Wyatt on 3 November 2007

To get search engine friendly urls in my rails application, all I had to do is the following 5 steps:

  1. Install the acts_as_urlnameable plugin using one of the following command:
    script/plugin install http://code.helicoid.net/svn/rails/plugins/acts_as_urlnameable/

    or if you’re using svn for your project, install with -x:

    script/plugin install -x http://code.helicoid.net/svn/rails/plugins/acts_as_urlnameable/

    or alternatively you could use piston.

  2. Next you need to add the call to acts_as_urlnameable to your model class:
    class Advert < ActiveRecord::Base
    
    acts_as_urlnameable :title
    
    end
  3. Now we need to add the migration for the urlnames table where we’ll store our new url names:
    class Urlnames < ActiveRecord::Migration  def self.up
    
    create_table :urlnames do |t|
    
    t.string  :nameable_type
    
    t.integer :nameable_id
    
    t.string  :name
    
    t.auto_dates
    
    end
    
    enddef self.down
    
    drop_table :urlnames
    
    end
    
    end
  4. Next we need to override the to_param method in the model class, this will allow us to control what rails use in the urls:
    def to_param
    
        urlname
    
    end
  5. Lastly, we need to update the ActiveRecord.find(params[:id]) calls to use the acts_as_urlnameable find_by_url method:
    # GET /adverts/1
    
    # GET /adverts/1.xml
    
    def show
    
    @advert = Advert.find_by_urlname(params[:id])
    
    respond_to do |format|

And there you have it, friendly urls…

Normally your show url for your model would look as follows (if you’re using RESTfull design)

http://localhost:3000/adverts/1

but now the url looks pretty….

http://localhost:3000/adverts/awesome_macbook_pro_17

There is much more you can do with the acts_as_urlnameable plugin, but I’d suggest you read the README file that does a good job of explaining how to use the plugin.

There are also other plugins you can use for friendly urls, here is a list of other plugins:

Powered by ScribeFire.

Posted in Rails, Rails Plugins, Software | 1 Comment »

CSS, JavaScript, Rails, Ruby, Rails Plugins, TextMate

Posted by Marcus Wyatt on 2 November 2007

CSS

JavaScript

Rails

Ruby

Rails Plugins

TextMate

Technorati Tags: , , , , ,

Powered by ScribeFire.

Posted in CSS, JavaScript, Rails, Rails Plugins, Ruby, TextMate | Leave a Comment »