2011-06-11から1日間の記事一覧

named_scopeについて

環境 Rails 3.0.8 確認用モデル生成 author $ rails g model author name:string book $ rails g model book author:references title:string price:integerauthor:referencesで生成するとBookモデルはbelongs_to :author ができます。 class Book < ActiveR…

model生成時の型の指定について

環境 Rails 3.0.8 rails generate model で生成するときのテーブルの型指定 ActiveRecord::ConnectionAdapters::TableDefinition :primary_key :string :text :integer :float :decimal :datetime :timestamp :time :date :binary :boolean integerのことをi…