mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
* Loosen pry, pry-byebug depencency ``` Resolving dependencies... byebug-9.1.0 requires ruby version >= 2.2.0, which is incompatible with the current version, ruby 2.1.10p492 ``` * Adjust nokogiri version constraint for CI Update appveyor Ruby to 2.3 to work around: ``` Gem::InstallError: nokogiri requires Ruby version < 2.5, >= 2.2. An error occurred while installing nokogiri (1.8.0), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.8.0'` succeeds before bundling. ``` and not 2.4 since: https://ci.appveyor.com/project/bf4/active-model-serializers/build/1.0.1052-fix_ci/job/0q3itabsnvnxr83u ``` nokogiri-1.6.8.1-x86-mingw32 requires ruby version < 2.4, which is incompatible with the current version, ruby 2.4.1p111 ``` * Include rails gem in Gemfile (For Rails5) In Rails5, checking for Rails::Railtie is better * Rails5 test env requires Rails.application.class.name rails-42d09f6b49da/railties/lib/rails/application.rb ```ruby def secret_key_base if Rails.env.test? || Rails.env.development? Digest::MD5.hexdigest self.class.name ``` * Reformat exclude matrix to be easier to read * Simplify jruby-travis config per rails/rails * Organize .travis.yml per rails/rails * Allow JRuby failure on Rails 5+; try rails-5 db adapter branch https://github.com/jruby/activerecord-jdbc-adapter/issues/708 ``` uninitialized constant ActiveRecord::ConnectionAdapters::Column::Format ``` see https://travis-ci.org/rails-api/active_model_serializers/jobs/277112008
54 lines
1.5 KiB
Ruby
54 lines
1.5 KiB
Ruby
require 'active_model'
|
|
require 'active_support'
|
|
require 'active_support/core_ext/object/with_options'
|
|
require 'active_support/core_ext/string/inflections'
|
|
require 'active_support/json'
|
|
module ActiveModelSerializers
|
|
extend ActiveSupport::Autoload
|
|
autoload :Model
|
|
autoload :Callbacks
|
|
autoload :Deserialization
|
|
autoload :SerializableResource
|
|
autoload :Logging
|
|
autoload :Test
|
|
autoload :Adapter
|
|
autoload :JsonPointer
|
|
autoload :Deprecate
|
|
autoload :LookupChain
|
|
|
|
class << self; attr_accessor :logger; end
|
|
self.logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT))
|
|
|
|
def self.config
|
|
ActiveModel::Serializer.config
|
|
end
|
|
|
|
# The file name and line number of the caller of the caller of this method.
|
|
def self.location_of_caller
|
|
caller[1] =~ /(.*?):(\d+).*?$/i
|
|
file = Regexp.last_match(1)
|
|
lineno = Regexp.last_match(2).to_i
|
|
|
|
[file, lineno]
|
|
end
|
|
|
|
# Memoized default include directive
|
|
# @return [JSONAPI::IncludeDirective]
|
|
def self.default_include_directive
|
|
@default_include_directive ||= JSONAPI::IncludeDirective.new(config.default_includes, allow_wildcard: true)
|
|
end
|
|
|
|
def self.silence_warnings
|
|
original_verbose = $VERBOSE
|
|
$VERBOSE = nil
|
|
yield
|
|
ensure
|
|
$VERBOSE = original_verbose
|
|
end
|
|
|
|
require 'active_model/serializer/version'
|
|
require 'active_model/serializer'
|
|
require 'active_model/serializable_resource'
|
|
require 'active_model_serializers/railtie' if defined?(::Rails::Railtie)
|
|
end
|