Rails 确认params的统一方法
创建: 2017/11/06
Gemfile | ### デバッグ出力の整形 gem 'awesome_print', :group => [:development, :test] |
application_controller | after_action :debug_mode_in_server def debug_mode_in_server case ENV['RAILS_ENV'] when "development", "test" puts %q(-------------------------------------------------------------------) puts %q( debugger mode) puts %q(-------------------------------------------------------------------) puts %Q(environment: #{ENV['RAILS_ENV']}) puts %q(------------------------------------------) puts %q( params) puts %q(------------------------------------------) ap params puts %Q(\n\n) # puts %q( finish debugger) # puts %q(-------------------------------------------------------------------) when "production" end |
config/application.rb 修改设定 |
config.action_controller.permit_all_parameters = true |