Sha256: 9174542f0587fd450940d8360d039b8e857f6134fba085e6d63b5ae2b3dea20c

Contents?: true

Size: 834 Bytes

Versions: 3

Compression:

Stored size: 834 Bytes

Contents

require "json_schema_rails/helpers"

module JsonSchemaRails
  class Engine < ::Rails::Engine
    isolate_namespace JsonSchemaRails

    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.2.1 lib/json_schema_rails/engine.rb
json_schema_rails-0.2.0 lib/json_schema_rails/engine.rb
json_schema_rails-0.1.0 lib/json_schema_rails/engine.rb