database_introspection 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +2 -2
- data/README.md +4 -4
- data/lib/database_introspection/dynamic_model/relations_analyser.rb +6 -0
- data/lib/database_introspection/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cd0364fb6db84e7d0ea71aa53a1412ef14bca45
|
4
|
+
data.tar.gz: 8917174991161cc2a4ac725bede0d380d90a7172
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d24103559b4cb23bd555bcf1b5589c8f6c345f2bb60130bd39c3a4ef28c591538c4e548230db6c0c2da0764fdaa9b5ebaa416b7ba56560f2e9992eea2bc5b82a
|
7
|
+
data.tar.gz: 841743af2764ab8ed9011fcfa2de830f1fee580d149224b1943cac05baac36368b272b223824dac4d506b6e18ab23513e8fc4b7468ccaad0e1ccea395fa7c467
|
data/LICENSE.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2013
|
1
|
+
Copyright (c) 2013 L.Briais
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -16,7 +16,7 @@ included in all copies or substantial portions of the Software.
|
|
16
16
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
17
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
18
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
|
19
|
+
NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ Or install it yourself as:
|
|
29
29
|
|
30
30
|
$ gem install database_introspection
|
31
31
|
|
32
|
-
Classes documentation is available [here]
|
32
|
+
Classes documentation is available [here][rubydoc]
|
33
33
|
|
34
34
|
## Usage
|
35
35
|
|
@@ -106,8 +106,7 @@ if `user_defined_table1` contains `user_defined_table2_id` or simply `table2_id`
|
|
106
106
|
## To do
|
107
107
|
|
108
108
|
* Improve Readme.
|
109
|
-
*
|
110
|
-
* Improve table relationship introspection.
|
109
|
+
* Improve code documentation.
|
111
110
|
|
112
111
|
## Contributing
|
113
112
|
|
@@ -118,4 +117,5 @@ if `user_defined_table1` contains `user_defined_table2_id` or simply `table2_id`
|
|
118
117
|
5. Create new Pull Request
|
119
118
|
|
120
119
|
|
121
|
-
[gemref]: https://rubygems.org/gems/database_introspection "Rails Database Introspection gem"
|
120
|
+
[gemref]: https://rubygems.org/gems/database_introspection "Rails Database Introspection gem"
|
121
|
+
[rubydoc]: http://rubydoc.info/gems/database_introspection/0.2.0/frames "Classes Documentation"
|
@@ -155,6 +155,9 @@ class DynamicModel::RelationsAnalyser
|
|
155
155
|
field_name = description[:class].list_name.to_sym
|
156
156
|
options = {class_name: description[:class].name}
|
157
157
|
model.has_many field_name, options
|
158
|
+
# Attribute for mass assignment
|
159
|
+
attr = field_name.to_s.singularize + "_ids"
|
160
|
+
model.attr_accessible *(model.attr_accessible[:default].to_a << attr)
|
158
161
|
puts " - has_many :#{field_name}, #{options.inspect}"
|
159
162
|
end
|
160
163
|
|
@@ -164,6 +167,9 @@ class DynamicModel::RelationsAnalyser
|
|
164
167
|
field_name = description[:class].list_name.to_sym
|
165
168
|
options = {through: description[:middle_class].list_name.to_sym, source: description[:class].list_name.singularize}
|
166
169
|
model.has_many field_name, options
|
170
|
+
# Attribute for mass assignment
|
171
|
+
attr = field_name.to_s.singularize + "_ids"
|
172
|
+
model.attr_accessible *(model.attr_accessible[:default].to_a << attr)
|
167
173
|
puts " - has_many :#{field_name}, #{options.inspect}"
|
168
174
|
end
|
169
175
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: database_introspection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- L.Briais
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|