databound 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8322326585649558acc1ed2eb32b33d482e98cbd
4
- data.tar.gz: fd4b49ed1dcde4d599c1dddcdf330ee7e74ff46d
3
+ metadata.gz: 3334543a69fe2a348a91f865c8c2b6896c13c31d
4
+ data.tar.gz: 59f1dd48c77e71adf27947be93180596962d8350
5
5
  SHA512:
6
- metadata.gz: 1d7652796be05f0dc3e95494f5094329332f433c276610b480a4fd61085d189a8e2b39482b5f9b5e5bfc41cd7c6bc59fcf969e3c88747f7657d5225ebf1cb2a6
7
- data.tar.gz: db5a2949024d7a5958cbdb1941ba3dde1f16183886344fbdf0f47a29ff500e204d7e0e71c98df98dc753be8772c107dc249b8373065aa248c8f594759467dc99
6
+ metadata.gz: f575cf04e296e6b40424cd298a83b7c43c3966e3b17397fa1e7a7aa4c9f8d04d63bb071b3a463f4a0960ebf9b58d6cc6b329a6810c9085c0087d328572e7439e
7
+ data.tar.gz: 95cf1d3cbb2f8c59f91bae9d24a40fa7e7301f0c68f9bfb3d266713317b009e6d5f0693c906332a893d405ddcfb1d40daf435df2a627909eee771b78cd0d136a
data/lib/databound.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'databound/initializer'
2
+ require 'databound/railtie'
1
3
  require 'databound/extensions'
2
4
  require 'databound/version'
3
5
  require 'databound/data'
@@ -7,10 +9,6 @@ require 'databound/controller'
7
9
  require 'databound/rails/routes'
8
10
 
9
11
  module Databound
10
- def self.included(base)
11
- base.send(:before_action, :init_crud, only: %i(where create update destroy))
12
- end
13
-
14
12
  def where
15
13
  records = @crud.find_scoped_records
16
14
  render json: serialize_array(records)
@@ -1,16 +1,6 @@
1
1
  module Databound
2
2
  class Controller
3
3
  class << self
4
- def add_application_controller_configs!
5
- def ApplicationController.databound(model = nil, &block)
6
- include Databound
7
-
8
- send(:define_method, :databound_config) do
9
- Databound::Config.new(block, model)
10
- end
11
- end
12
- end
13
-
14
4
  def find_or_create(name, resource, opts)
15
5
  find(name) || create(name, resource, opts)
16
6
  end
@@ -0,0 +1,12 @@
1
+ module Databound
2
+ module Initializer
3
+ def databound(model = nil, &block)
4
+ include Databound
5
+
6
+ send(:before_filter, :init_crud, only: %i(where create update destroy))
7
+ send(:define_method, :databound_config) do
8
+ Databound::Config.new(block, model)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -3,7 +3,6 @@ class ActionDispatch::Routing::Mapper
3
3
  namespace = @scope[:path]
4
4
  namespace = namespace[1..-1] if namespace
5
5
  opts = resources.pop if resources.last.is_a?(Hash)
6
- Databound::Controller.add_application_controller_configs!
7
6
 
8
7
  resources.each do |resource|
9
8
  Rails.application.routes.draw do
@@ -0,0 +1,9 @@
1
+ module Databound
2
+ class Railtie < Rails::Railtie
3
+ initializer 'databound.databound_to_action_controller' do
4
+ ActiveSupport.on_load(:action_controller) do
5
+ extend Databound::Initializer
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Databound
2
- VERSION = '3.0.2'
2
+ VERSION = '3.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: databound
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domas Bitvinskas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-08 00:00:00.000000000 Z
11
+ date: 2015-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-rails
@@ -143,8 +143,10 @@ files:
143
143
  - lib/databound/controller.rb
144
144
  - lib/databound/data.rb
145
145
  - lib/databound/extensions.rb
146
+ - lib/databound/initializer.rb
146
147
  - lib/databound/manager.rb
147
148
  - lib/databound/rails/routes.rb
149
+ - lib/databound/railtie.rb
148
150
  - lib/databound/version.rb
149
151
  - lib/generators/databound/install/install_generator.rb
150
152
  - lib/generators/databound/install/templates/application.js