Tag: Rails/アップグレード
bundle update
bundle exec rails app:update
class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end
class Book < ApplicationRecord end
NoMethodError: assigns has been extracted to a gem. To continue using it, add `gem 'rails-controller-testing'` to your Gemfile.
group :test do gem "rails-controller-testing" end
.DEPRECATION WARNING: Using positional arguments in functional tests has been deprecated, in favor of keyword arguments, and will be removed in Rails 5.1. Deprecated style: get :show, { id: 1 }, nil, { notice: "This is a flash message" } New keyword style: get :show, params: { id: 1 }, flash: { notice: "This is a flash message" }, session: nil # Can safely be omitted.
post :create, params: {book: { author: @book.author, summary: @book.summary, title: @book.title } } get :show, params: {id: @book}
gem 'jbuilder', '~> 2.5'
def take_params(*param_keys) overwrites = param_keys.extract_options! param_keys = default_take_param_keys if param_keys.blank? params.to_unsafe_h.extract!(*param_keys).update(overwrites) end helper_method :take_params
gem 'activemodel-serializers-xml'
require File.expand_path('../application', __FILE__)
config.active_record.raise_in_transactional_callbacks = true
# get ':namespace:controller(/:action(/:id))(.:format)'