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 +4 -4
- data/lib/databound.rb +2 -4
- data/lib/databound/controller.rb +0 -10
- data/lib/databound/initializer.rb +12 -0
- data/lib/databound/rails/routes.rb +0 -1
- data/lib/databound/railtie.rb +9 -0
- data/lib/databound/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3334543a69fe2a348a91f865c8c2b6896c13c31d
|
4
|
+
data.tar.gz: 59f1dd48c77e71adf27947be93180596962d8350
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
data/lib/databound/controller.rb
CHANGED
@@ -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
|
data/lib/databound/version.rb
CHANGED
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.
|
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-
|
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
|