Screencast: Upgrade auf Rails 3.2

 

Downloads in verschiedenen Formaten:

mp4
m4v
webm
ogg

 

Resourcen:

Gemfile

gem 'rails', '3.2.0' 
group :assets do 
  gem 'sass-rails', " ~> 3.2.3" 
  gem 'coffee-rails', "~> 3.2.1" 
  gem 'uglifier', '>= 1.0.3' 
end

terminal

bundle update 
rails g model product_variation product_id:integer:index name 'price:decimal{7,2}' 
rails g migration add_properties_to_product_variations properties:text 
rake db:migrate 
echo -d postgresql -T > ~/.railsrc

rails console

puts Product.order(:name).explain 
ActiveRecord::Base.silence_auto_explain { Product.order(:name) } 
Product.pluck(:name) 
Product.pluck(:id) 
Product.select(:name).uniq 
Product.where(name: "Foo").first_or_create! 
Product.where(name: "Foo").first_or_create!(price: 5) 
"Product".safe_constantize 
p = ProductVariation.new(color: 'blue', size: 3) 
p.color 
p.size 
p.properties[:color]

config/development.rb

# Raise exception on mass assignment protection for Active Record models 
config.active_record.mass_assignment_sanitizer = :strict 

# Log the query plan for queries taking more than this (works 
# with SQLite, MySQL, and PostgreSQL) 
config.active_record.auto_explain_threshold_in_seconds = 0.5 

config.log_tags = [:uuid, :remote_ip]

config/test.rb

# Raise exception on mass assignment protection for Active Record models 
config.active_record.mass_assignment_sanitizer = :strict

models/product_variation.rb

store :properties, accessors: [:color, :size]

2 Gedanken zu „Screencast: Upgrade auf Rails 3.2“

  1. Ah, das ist ja mal Klasse. Gibt es das in irgendeiner gearteten Form auch für Windows? Also vorkompiliert?

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>