Sha256: a1531c188b6ecb9052cded0e4c444ce8f7b4966cfe95d7cfa597b7d9aece49a2

Contents?: true

Size: 797 Bytes

Versions: 3

Compression:

Stored size: 797 Bytes

Contents

require "json_schema_rails/helpers"

module JsonSchemaRails
  class Railtie < ::Rails::Railtie
    initializer "json_schema_rails.set_schema_loader" do |app|
      if schema_file = Dir[app.root.join('app', 'schema.*')].first
        loader = JsonSchemaRails::Loaders::HyperSchema.new(schema_file)
      else
        loader = JsonSchemaRails::Loaders::Directory.new(app.root.join('app', 'schemas').to_path)
      end
      loader.cache = false if Rails.env.development?
      JsonSchemaRails.schema_loader = loader
    end

    initializer "json_schema_rails.include_helpers" do
      ActiveSupport.on_load :action_controller do
        include ::JsonSchemaRails::Helpers
      end
    end

    rake_tasks do
      load File.expand_path("../../tasks/schema_tasks.rake", __FILE__)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
json_schema_rails-0.0.3 lib/json_schema_rails/railtie.rb
json_schema_rails-0.0.2 lib/json_schema_rails/railtie.rb
json_schema_rails-0.0.1 lib/json_schema_rails/railtie.rb