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...
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...
I’m trying to find all Users with an id greater than 200, but I’m having some trouble with the specific syntax. User.where(:id > 200) and User.where("? > 200", :id)...
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...
I am trying to convert a name from snake case to camel case. Are there any built-in methods? Eg: "app_user" to "AppUser" (I have a string "app_user" I want...
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,...
I need to add timestamps (created_at & updated_at) to an existing table. I tried the following code but it didn’t work. class AddTimestampsToUser < ActiveRecord::Migration def change_table add_timestamps(:users) end...
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...
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...
I have a rake task that won’t work unless a table exists. I’m working with more than 20 engineers on a website so I want to make sure they...