i18n_scaffold_controller_template 1.0.4 → 1.0.5

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: b83a51450873df3a897d50ebfc83fa9df0f7f007
4
- data.tar.gz: 3a6e662d8c39267798b8be44a5fa43ae0dd405c1
3
+ metadata.gz: 239b2a695c0d5f563b5cfafe90109af97eb75c5b
4
+ data.tar.gz: b892996335c741604d03c77ddef14094659329d5
5
5
  SHA512:
6
- metadata.gz: e49a8b1ba0ca62282692f016213cfccaa344df2a8fe097f02516d970c41b38953f8f41b730eae57e6b4d3eb5a3f8a49b5e9da92a3467b619fb276e29c9526f2b
7
- data.tar.gz: 03a1b1a400717a954a12bdecbd591961394d3b86f526dac06e33c9ed7e1a5bc3b87c05b709345c0ecab0cad654a83aa7f6e3626165350806e6fb6bb2a74b86ce
6
+ metadata.gz: 9a98bc5c1457f70b182db9f11f2b18ae19f17ee88be8066bcbbc29611906484b812fd646d7f34d619df19bd880f566c6207a376ee640eb8dc2623cd035436411
7
+ data.tar.gz: bb47520feda9488fdf8466d342450649b9361df41052f30264091900406c78886487f2d173bcd1a7216e38fd3dc7301df04c5e97eb9956f7b0d2fd15314b0d54
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.0.5
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: i18n_scaffold_controller_template 1.0.4 ruby lib
5
+ # stub: i18n_scaffold_controller_template 1.0.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "i18n_scaffold_controller_template"
9
- s.version = "1.0.4"
9
+ s.version = "1.0.5"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Dmitri Koulikoff"]
14
- s.date = "2014-11-09"
14
+ s.date = "2015-02-24"
15
15
  s.description = "Scaffold controller template expoiting i18n and aware of cancan and WiceGrid"
16
16
  s.email = "dima@koulikoff.ru"
17
17
  s.extra_rdoc_files = [
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
34
34
  ]
35
35
  s.homepage = "http://github.com/dima4p/i18n_scaffold_controller_template"
36
36
  s.licenses = ["MIT"]
37
- s.rubygems_version = "2.2.2"
37
+ s.rubygems_version = "2.4.5"
38
38
  s.summary = "Scaffold controller template expoiting i18n and aware of cancan and WiceGrid"
39
39
 
40
40
  if s.respond_to? :specification_version then
@@ -13,6 +13,7 @@ class <%= controller_class_name %>Controller < ApplicationController
13
13
  <% end -%>
14
14
 
15
15
  # GET <%= route_url %>
16
+ # GET <%= route_url %>.json
16
17
  def index
17
18
  # @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
18
19
  <% if defined? Wice::WiceGrid -%>
@@ -21,6 +22,7 @@ class <%= controller_class_name %>Controller < ApplicationController
21
22
  end
22
23
 
23
24
  # GET <%= route_url %>/1
25
+ # GET <%= route_url %>/1.json
24
26
  def show
25
27
  end
26
28
 
@@ -38,6 +40,7 @@ class <%= controller_class_name %>Controller < ApplicationController
38
40
  end
39
41
 
40
42
  # POST <%= route_url %>
43
+ # POST <%= route_url %>.json
41
44
  def create
42
45
  <% if Rails.application.config.generators.options[:rails][:cancan] -%>
43
46
  # @<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
@@ -45,26 +48,39 @@ class <%= controller_class_name %>Controller < ApplicationController
45
48
  @<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
46
49
  <% end -%>
47
50
 
48
- if @<%= orm_instance.save %>
49
- redirect_to @<%= singular_table_name %>, notice: t('<%= table_name %>.was_created')
50
- else
51
- render action: 'new'
51
+ respond_to do |format|
52
+ if @<%= orm_instance.save %>
53
+ format.html { redirect_to @<%= singular_table_name %>, notice: t('<%= table_name %>.was_created') }
54
+ format.json { render :show, status: :created, location: @<%= singular_table_name %> }
55
+ else
56
+ format.html { render :new }
57
+ format.json { render json: @<%= singular_table_name %>.errors, status: :unprocessable_entity }
58
+ end
52
59
  end
53
60
  end
54
61
 
55
62
  # PATCH/PUT <%= route_url %>/1
63
+ # PATCH/PUT <%= route_url %>/1.json
56
64
  def update
57
- if @<%= orm_instance.update("#{singular_table_name}_params") %>
58
- redirect_to @<%= singular_table_name %>, notice: t('<%= table_name %>.was_updated')
59
- else
60
- render action: 'edit'
65
+ respond_to do |format|
66
+ if @<%= orm_instance.update("#{singular_table_name}_params") %>
67
+ format.html { redirect_to @<%= singular_table_name %>, notice: t('<%= table_name %>.was_updated') }
68
+ format.json { render :show, status: :ok, location: @<%= singular_table_name %> }
69
+ else
70
+ format.html { render :edit }
71
+ format.json { render json: @<%= singular_table_name %>.errors, status: :unprocessable_entity }
72
+ end
61
73
  end
62
74
  end
63
75
 
64
76
  # DELETE <%= route_url %>/1
77
+ # DELETE <%= route_url %>/1.json
65
78
  def destroy
66
79
  @<%= orm_instance.destroy %>
67
- redirect_to <%= index_helper %>_url, notice: t('<%= table_name %>.was_deleted')
80
+ respond_to do |format|
81
+ format.html { redirect_to <%= index_helper %>_url, notice: t('<%= table_name %>.was_deleted') }
82
+ format.json { head :no_content }
83
+ end
68
84
  end
69
85
 
70
86
  private
@@ -81,7 +97,7 @@ class <%= controller_class_name %>Controller < ApplicationController
81
97
  end
82
98
  <% end -%>
83
99
 
84
- # Only allow a trusted parameter "white list" through.
100
+ # Never trust parameters from the scary internet, only allow the white list through.
85
101
  def <%= "#{singular_table_name}_params" %>
86
102
  <%- if attributes_names.empty? -%>
87
103
  params[<%= ":#{singular_table_name}" %>]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_scaffold_controller_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitri Koulikoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-09 00:00:00.000000000 Z
11
+ date: 2015-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.2.2
123
+ rubygems_version: 2.4.5
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: Scaffold controller template expoiting i18n and aware of cancan and WiceGrid