Is there documentation for the Rails column types?

I’m looking for more than the simple type listing that is found on this page: :primary_key, :string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean But is there any documentation that actually defines these fields? Specifically: What’s the difference between :string and :text? Between :float and :decimal? What are the distinguishing features of … Read more

In Ruby on Rails, how do I format a date with the “th” suffix, as in, “Sun Oct 5th”?

I want to display dates in the format: short day of week, short month, day of month without leading zero but including “th”, “st”, “nd”, or “rd” suffix. For example, the day this question was asked would display “Thu Oct 2nd”. I’m using Ruby 1.8.7, and Time.strftime just doesn’t seem to do this. I’d prefer … Read more

Ruby on Rails and Rake problems: uninitialized constant Rake::DSL

I’m having a really frustrating issue: Rake is being dumb. Here’s how the problem comes about: $ rails new test_app $ rails generate scaffold new_scaffold field1:string field2:text Both of those work just fine, but then when I do this, $ rake db:migrate I get the following error. (in /home/mikhail/test_app) rake aborted! uninitialized constant Rake::DSL /usr/lib/ruby/1.9.1/rake.rb:2482:in … Read more

Rails migrations: Undo default setting for a column

I have the problem, that I have an migration in Rails that sets up a default setting for a column, like this example: def self.up add_column :column_name, :bought_at, :datetime, :default => Time.now end Suppose, I like to drop that default settings in a later migration, how do I do that with using rails migrations? My … Read more

Error installing libv8: ERROR: Failed to build gem native extension

I made a rails project with, rails new test_bootstrap. succeeded. moved to the project dir and added the gems gem “therubyracer” gem “less-rails” #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS gem “twitter-bootstrap-rails” and run bundle install after that, i have this error. Installing libv8 (3.16.14.3) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem … Read more

Combine two ActiveRecord::Relation objects

Suppose I have the following two objects: first_name_relation = User.where(:first_name => ‘Tobias’) # ActiveRecord::Relation last_name_relation = User.where(:last_name => ‘Fünke’) # ActiveRecord::Relation is it possible to combine the two relations to produce one ActiveRecord::Relation object containing both conditions? Note: I’m aware that I can chain the wheres to get this behavior, what I’m really interested in … Read more