model_info 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d047b94cd0cff94dea2de1cd32dd2b0d5cc577a
4
- data.tar.gz: 14a4a6a7f2e23d0b9a79e68504a86b297b2ef135
3
+ metadata.gz: 0d60909947007c4b0fb00761dc286434e8ca1503
4
+ data.tar.gz: 6e1a6d29bf32c967605fea4579044fe5e1ca7a03
5
5
  SHA512:
6
- metadata.gz: 1deb3b38ff2452351865c5fd8c9db8fa635ef6b738fae405f0a26141be3afb577c4e2234b5aec03dfa421ad4f83ff108e2f081ea56edb4fa5acbe4c0c0e85106
7
- data.tar.gz: ee31540d40380546c60b68511eab44185c3fe5cdd966e3d7ec623de470500151937206b4d0080da2a4c5e932e1ca0f7100e74ec395f04c9387cb5b29707f4366
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
- class DownloadsController < ApplicationController
4
- before_filter :authenticate_request
3
+ class DownloadsController < ApplicationController
4
+ before_filter :authenticate_request
5
5
 
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
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
- 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
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
- 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
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
- private
31
+ private
32
32
 
33
- def authenticate_request
34
- if params[:associated_model]
35
- fetch_associated_model_data
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
- def fetch_model_data
42
- @model_data = params[:model_class].constantize.all
43
- end
37
+ def fetch_model_data
38
+ @model_data = params[:model_class].constantize.all
39
+ end
44
40
 
45
- def fetch_associated_model_data
46
- @model_data = params[:model_class].constantize.find(params[:model_object_id]).send(params[:associated_model])
47
- end
48
- end
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
@@ -1,5 +1,4 @@
1
1
  require 'kaminari'
2
- require 'bootstrap'
3
2
  require 'csv'
4
3
  module ModelInfo
5
4
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module ModelInfo
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
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.5
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: 2015-09-03 00:00:00.000000000 Z
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.16.3
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.16.3
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.6
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