I hereby claim:
- I am rhodee on github.
- I am rhodee (https://keybase.io/rhodee) on keybase.
- I have a public key ASBui_bwfQNNMp65XpDZMhNvmZ7RfLmDyEzahkdT3gjRvgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| javascript:(function() {var e = document.getElementById('pull_request_body'); if (e) {e.value += '#### What\'s this PR do?\n\n\n#### Where should the reviewer start?\n\n\n#### How should this be manually tested?\n\n\n#### Any background context you want to provide?\n\n\n#### What are the relevant tickets?\n\n\n#### Screenshots (if appropriate):\n\n\n\n\n\n#### Questions:\n\n\n'}})(); |
| class Configurator | |
| def self.configure(&block) | |
| configuration ||= new | |
| configuration.instance_eval(&block) | |
| return configuration | |
| end | |
| def respond_to_missing?(method_name, include_private = false) | |
| super unless self.instance_variables.include?(convert_method_to_symbol(method_name)) |
| #!/usr/bin/env ruby | |
| # Drop in .git/hooks | |
| # Make executable and get back to werk. | |
| # Stash files not to be committed | |
| system('git stash -q --keep-index') | |
| # check for rake | |
| rake_available = system('bundle list | grep rake > /dev/null') |
| $VERBOSE = nil | |
| require File.expand_path('../rooby', __FILE__) | |
| Person = Rooby::Class.new 'Person' do | |
| define :initialize do |name| | |
| @name = name | |
| end | |
| define :name do |
By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.
| # MySQL. Versions 4.1 and 5.0 are recommended. | |
| # | |
| # Install the MySQL driver: | |
| # gem install mysql2 | |
| # | |
| # And be sure to use new-style password hashing: | |
| # http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
| defaults: &defaults | |
| adapter: mysql2 #or mysql |