test/dummy/app/controllers/articles_controller.rb in paper_trail-4.2.0 vs test/dummy/app/controllers/articles_controller.rb in paper_trail-5.0.0

- old
+ new

@@ -1,17 +1,20 @@ class ArticlesController < ApplicationController def create - if PaperTrail.active_record_protected_attributes? - @article = Article.create params[:article] - else - @article = Article.create params.require(:article).permit! - end + @article = Article.create article_params head :ok end def current_user - 'foobar'.tap do |string| - # Invoking `id` returns the `object_id` value in Ruby18 by default - string.class_eval { undef_method(:id) } if RUBY_VERSION < '1.9' + "foobar" + end + + private + + def article_params + if PaperTrail.active_record_protected_attributes? + params[:article] + else + params.require(:article).permit! end end end