If you need to do calculations inside the database and can not use Ruby objects you may run into problems...
When a has_many association basically serves to store a list of associated strings (tags, categories, ...), it can be convenient...
When you just went through a long debug-fest and infested your code with dozens of debug messages, it can...
Note that this card is very old. You might want to use ActiveType for your auto-coerced virtual attributes instead...
Don't insert table rows in a Rails database migration. This will break tests that expect that database to be...
Occasionally some complex query must be processed on the database because building thousands of Ruby objects is impracticable.
Plugins (and gems) are typically tested using a complete sample rails application that lives in the spec folder of the...
When you use will_paginage to paginate a scope, and you want to obtain the total number of records matched...
You most likely never want to do this. But if you do: Model.update_all({:id => new_id}, {:id => old_id...
To only run the next two migrations: rake db:migrate STEP=2 To revert the previous two migrations:
Use this scope: class Stick named_scope :shuffled, lambda { last_record = last { :conditions => [ 'id >= ?', rand(last_record.id) ] } if last_record }
Use this MySQL command to show further info about a table: SHOW CREATE TABLE tags; This will output a table...
You can now add an :inverse_of option to has_one, has_many and belongs_to associations.... Without :inverse_of...
You will need to upgrade to RSpec >= 2 and rspec-rails >= 2 for Rails 3. Here are some hints to...
If you need to look at the list of methods that are called upon certain events (like before/after saving etc...
When you do tags with acts-as-taggable-on and want to preload associated tags, you can do so with...
If you want to see how long your database queries actually take, you need to disable MySQL's query cache...
Hooks lets you define hooks declaratively in your ruby class. You can add callbacks to your hook, which will be...
Note that you should disable the Java plug-in in your browsers after installation. Ubuntu >= 12.04 Java 11
You can use record.send(:update_without_callbacks) or record.send(:create_without_callbacks) This can be used as a...
Find conditions for scopes can be given either as an array (:conditions => ['state = ?', 'draft']) or a hash (:conditions => { 'state' => 'draft...
When using virtual attributes, the attached trait can be useful to automatically copy errors from one attribute to another.
power-rake db:migrate VERSION=20100913132321 By default the environments development, test, cucumber and performance are considered...
When Paperclip attachments should only be downloadable for selected users, there are three ways to go. The same applies to...