Sha256: 00c5ea209849a53777fd16312d0db3e12adc0f55d67f8c24b474787e85c7a37a

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require 'active_support'
require 'active_record'
require 'active_model/serializer'
require 'active_model/serializer_support'
require 'active_model/serializer/version'
require 'active_model/serializer/railtie' if defined?(Rails) && defined?(Rails::Railtie)

ActiveModel::Errors = ActiveRecord::Errors #fix for authlogic gem

module ActiveSupport
  module Inflector
    def safe_constantize(camel_cased_word)
      begin
        constantize(camel_cased_word)
      rescue NameError => e
        raise unless e.message =~ /(uninitialized constant|wrong constant name) #{const_regexp(camel_cased_word)}$/ ||
          e.name.to_s == camel_cased_word.to_s
      rescue ArgumentError => e
        raise unless e.message =~ /not missing constant #{const_regexp(camel_cased_word)}\!$/
      end
    end
  end
end
begin
  require 'action_controller'
  require 'action_controller/serialization'

  ActiveSupport.on_load(:action_controller) do
    include ::ActionController::Serialization
  end
rescue LoadError
  # rails not installed, continuing
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_model_serializers_rails_2.3-0.9.0.alpha1 lib/active_model_serializers.rb
active_model_serializers_rails_2.3-0.9.0.pre2 lib/active_model_serializers.rb