model_info 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +5 -1
- data/app/controllers/model_info/downloads_controller.rb +35 -39
- data/lib/model_info/engine.rb +0 -1
- data/lib/model_info/version.rb +1 -1
- metadata +7 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d60909947007c4b0fb00761dc286434e8ca1503
|
4
|
+
data.tar.gz: 6e1a6d29bf32c967605fea4579044fe5e1ca7a03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bbf5e531deafd2f1820f3c8cf2ec88955ef39b60e307d977ead423d65b45ef771db6d058c034d9476c8725fb01377f61acafbc7028267d4518d05c7a4fe40cf
|
7
|
+
data.tar.gz: 067b3566e0fddd8e0f5dcc2796deaa396f250dc3141fb04e636eb97e2cdbd257805a3a00e0405ec20f8fbc23dc64f5e044e89628a215b382f963885896acc4f1
|
data/README.rdoc
CHANGED
@@ -20,7 +20,11 @@ To use this gem you just need to mount it in your route file *config/routes.rb*
|
|
20
20
|
|
21
21
|
Then to go to the dashboard hit the url as:
|
22
22
|
|
23
|
-
your_application_url */model_info/models*
|
23
|
+
your_application_url */model_info/models* you will get all models of your application
|
24
|
+
|
25
|
+
== Downloads
|
26
|
+
|
27
|
+
You can download *CSV* *JSON* and *XML* formats of your model and associated model.
|
24
28
|
|
25
29
|
== Working Status
|
26
30
|
|
@@ -1,49 +1,45 @@
|
|
1
1
|
require_dependency "model_info/application_controller"
|
2
2
|
module ModelInfo
|
3
|
-
|
4
|
-
|
3
|
+
class DownloadsController < ApplicationController
|
4
|
+
before_filter :authenticate_request
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
6
|
+
def download_csv
|
7
|
+
csv_string = CSV.generate do |csv|
|
8
|
+
csv << params[:model_class].constantize.column_names
|
9
|
+
@model_data.each do |model|
|
10
|
+
values = model.attributes.values
|
11
|
+
csv.add_row values
|
12
|
+
end
|
13
|
+
end
|
14
|
+
send_data csv_string,
|
15
|
+
:type => 'text/csv; charset=iso-8859-1; header=present',
|
16
|
+
:disposition => "attachment; filename=#{params[:model_class]}-#{DateTime.now}.csv"
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
def download_json
|
20
|
+
send_data @model_data.to_json,
|
21
|
+
:type => 'text/json; charset=iso-8859-1; header=present',
|
22
|
+
:disposition => "attachment; filename=#{params[:model_class]}-#{DateTime.now}.json"
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
def download_xml
|
26
|
+
send_data @model_data.to_xml,
|
27
|
+
:type => 'text/xml; charset=iso-8859-1; header=present',
|
28
|
+
:disposiftion => "attachment; filename=#{params[:model_class]}-#{DateTime.now}.xml"
|
29
|
+
end
|
30
30
|
|
31
|
-
|
31
|
+
private
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
else
|
37
|
-
fetch_model_data
|
38
|
-
end
|
39
|
-
end
|
33
|
+
def authenticate_request
|
34
|
+
params[:associated_model] ? fetch_associated_model_data : fetch_model_data
|
35
|
+
end
|
40
36
|
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
def fetch_model_data
|
38
|
+
@model_data = params[:model_class].constantize.all
|
39
|
+
end
|
44
40
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
def fetch_associated_model_data
|
42
|
+
@model_data = params[:model_class].constantize.find(params[:model_object_id]).send(params[:associated_model])
|
43
|
+
end
|
44
|
+
end
|
49
45
|
end
|
data/lib/model_info/engine.rb
CHANGED
data/lib/model_info/version.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: model_info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nitanshu verma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bootstrap
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.1
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.1
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: kaminari
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- -
|
17
|
+
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0
|
19
|
+
version: '0'
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
|
-
- -
|
24
|
+
- - ">="
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0
|
26
|
+
version: '0'
|
41
27
|
description: ModelInfo gem build on a thought where you should not write a single
|
42
28
|
line of code and you can CRUD each model(including engine's) and their associated
|
43
29
|
models.
|
@@ -101,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
87
|
version: '0'
|
102
88
|
requirements: []
|
103
89
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.4.
|
90
|
+
rubygems_version: 2.4.8
|
105
91
|
signing_key:
|
106
92
|
specification_version: 4
|
107
93
|
summary: ModelInfo provides the CRUD of all model's and their associated model's
|