Tags » Rails

Retrieving a Single Object with Active Record

Active Record has several ways to get a single object.

find: Retrieve a record by primary key


customer = Customer.find(8)              # find a customer with primary key (id) of 8
# sql equivalent: select * from customers where (customers.id = 8) LIMIT 1
… 299 more words

Pretend to generate without really generating!

When running ‘rails generate’, you can add a -p (pretend) flag at the end of the command to see what the output will look like, without actually running it. 91 more words


Simple guide to devise

Will probably have to switch to using OAuh  at some point but for future reference, here’s a reasoable looking guide to using Devise for Rails applications: 6 more words

Ruby On Rails

Set up Rails environment

Do following steps to setup rails environment in the local system

1) CSV : Git and Subversion

sudo aptitude install subversion
 sudo apt-get install git-core… 200 more words

SVN ignorelist in a Rails project

During the initial import of a typical Rails application into SVN, here is the recommended list of Rails components to be added to SVN ignore list - 7 more words


Gotcha - mysql error [ database configuration does not specify adapter]

Source of Error

> RAILS_ENV=Production rake db:migrate

rake aborted!
database configuration does not specify adapter

Gotcha -

There is no environment called Production so obviously there is no adapter specified for this environment in database.yml.

17 more words