config.queue = ActiveSupport::Queue # Jobs run via Resque config.queue = ??? # Jobs run via delayed_job config.queue = ??? # Jobs run via Sidekiq (rails4 branch) config.queue = Sidekiq::Client::Queue
from a controller raises ActiveModel::ForbiddenAttributesError • Mass-assigned model methods used elsewhere in the app accept all params • attr_accessible & attr_protected removed and extracted to the protected_attributes gem
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id # Rails 4 > nil.id NoMethodError: undefined method `id' for nil:NilClass
update_attributes( :name => "value") YES YES YES YES update_attribute( :name, "value") NO YES YES YES update_columns( :name => "value") NO NO NO NO update_column( :name, "value") NO NO NO NO
We're talking old school plugins • vendor/plugins is no longer a thing • Move plugins to lib/ and require manually in config/initializers • Or create a gemified version and manage via Bundler
Pitfall scope :recent, where("created_at > ?", 1.week.ago) # Use a lambda (always, not just for time!) scope :published, -> { where(:published => true) }
options end concern :image_attachable do resources :images, only: :index end resources :posts, concerns: [:commentable, : image_attachable] do resource :video, concerns: :commentable end