mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
Railsify dummy app (rails v5.*) (#810)
* add filter_parameter_logging initializer * models in rails 5.* should be inherited from abstract application record class
This commit is contained in:
parent
727c9101ff
commit
607f03e908
6 changed files with 17 additions and 4 deletions
3
spec/dummy/app/models/application_record.rb
Normal file
3
spec/dummy/app/models/application_record.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class ApplicationRecord < ActiveRecord::Base
|
||||||
|
self.abstract_class = true
|
||||||
|
end
|
|
@ -1,3 +1,3 @@
|
||||||
class Post < ActiveRecord::Base
|
class Post < ApplicationRecord
|
||||||
# attr_accessible :title, :body
|
# attr_accessible :title, :body
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,9 +38,6 @@ module Dummy
|
||||||
# Configure the default encoding used in templates for Ruby 1.9.
|
# Configure the default encoding used in templates for Ruby 1.9.
|
||||||
config.encoding = "utf-8"
|
config.encoding = "utf-8"
|
||||||
|
|
||||||
# Configure sensitive parameters which will be filtered from the log file.
|
|
||||||
config.filter_parameters += [:password]
|
|
||||||
|
|
||||||
# Enable escaping HTML in JSON.
|
# Enable escaping HTML in JSON.
|
||||||
config.active_support.escape_html_entities_in_json = true
|
config.active_support.escape_html_entities_in_json = true
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Configure sensitive parameters which will be filtered from the log file.
|
||||||
|
Rails.application.config.filter_parameters += [:password]
|
7
spec/dummy/spec/models/application_spec.rb
Normal file
7
spec/dummy/spec/models/application_spec.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe ApplicationRecord do
|
||||||
|
it { expect(described_class.superclass).to eq ActiveRecord::Base }
|
||||||
|
|
||||||
|
it { expect(described_class.abstract_class).to be_truthy }
|
||||||
|
end
|
|
@ -3,4 +3,6 @@ require 'shared_examples/decoratable'
|
||||||
|
|
||||||
describe Post do
|
describe Post do
|
||||||
it_behaves_like "a decoratable model"
|
it_behaves_like "a decoratable model"
|
||||||
|
|
||||||
|
it { should be_a ApplicationRecord }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue