responders 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/generators/rails/templates/controller.rb +17 -15
- data/lib/responders.rb +1 -1
- data/lib/responders/version.rb +1 -1
- data/test/test_helper.rb +0 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d10c5ba8c6762f3d9554a9474cf02f8b4c1a0e20
|
4
|
+
data.tar.gz: 5b9a35e9669c0219287450813a7f6dbeeae1df5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0514aae5e8307def2b6c6be5970ffaae0195ae50cb6880314dd25e68ee9cf4b3bdcfed65ff18193a08ab53488b4517319ddb66cc4abd6051e11ad05efb9b1052
|
7
|
+
data.tar.gz: 93db7f8e08401a53d6f0e79f894e2858d59f1ca231293f5b2821b94ce6eee05e83c305cb4ad69fbbefb71e718b6ceae7000fc3b9c02795a72320aa8106fdef0f
|
data/CHANGELOG.md
CHANGED
@@ -1,53 +1,55 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
class <%= controller_class_name %>Controller < ApplicationController
|
3
|
-
<%= controller_before_filter %> :set_<%=
|
3
|
+
<%= controller_before_filter %> :set_<%= singular_table_name %>, only: [:show, :edit, :update, :destroy]
|
4
|
+
|
5
|
+
respond_to :html
|
4
6
|
|
5
7
|
<% unless options[:singleton] -%>
|
6
8
|
def index
|
7
|
-
@<%=
|
8
|
-
respond_with(@<%=
|
9
|
+
@<%= plural_table_name %> = <%= orm_class.all(class_name) %>
|
10
|
+
respond_with(@<%= plural_table_name %>)
|
9
11
|
end
|
10
12
|
<% end -%>
|
11
13
|
|
12
14
|
def show
|
13
|
-
respond_with(@<%=
|
15
|
+
respond_with(@<%= singular_table_name %>)
|
14
16
|
end
|
15
17
|
|
16
18
|
def new
|
17
|
-
@<%=
|
18
|
-
respond_with(@<%=
|
19
|
+
@<%= singular_table_name %> = <%= orm_class.build(class_name) %>
|
20
|
+
respond_with(@<%= singular_table_name %>)
|
19
21
|
end
|
20
22
|
|
21
23
|
def edit
|
22
24
|
end
|
23
25
|
|
24
26
|
def create
|
25
|
-
@<%=
|
27
|
+
@<%= singular_table_name %> = <%= orm_class.build(class_name, attributes_params) %>
|
26
28
|
<%= "flash[:notice] = '#{class_name} was successfully created.' if " if flash? %>@<%= orm_instance.save %>
|
27
|
-
respond_with(@<%=
|
29
|
+
respond_with(@<%= singular_table_name %>)
|
28
30
|
end
|
29
31
|
|
30
32
|
def update
|
31
33
|
<%= "flash[:notice] = '#{class_name} was successfully updated.' if " if flash? %>@<%= orm_instance_update(attributes_params) %>
|
32
|
-
respond_with(@<%=
|
34
|
+
respond_with(@<%= singular_table_name %>)
|
33
35
|
end
|
34
36
|
|
35
37
|
def destroy
|
36
38
|
@<%= orm_instance.destroy %>
|
37
|
-
respond_with(@<%=
|
39
|
+
respond_with(@<%= singular_table_name %>)
|
38
40
|
end
|
39
41
|
|
40
42
|
private
|
41
|
-
def set_<%=
|
42
|
-
@<%=
|
43
|
+
def set_<%= singular_table_name %>
|
44
|
+
@<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
43
45
|
end
|
44
46
|
<%- if strong_parameters_defined? -%>
|
45
47
|
|
46
|
-
def <%= "#{
|
48
|
+
def <%= "#{singular_table_name}_params" %>
|
47
49
|
<%- if attributes_names.empty? -%>
|
48
|
-
params[:<%=
|
50
|
+
params[:<%= singular_table_name %>]
|
49
51
|
<%- else -%>
|
50
|
-
params.require(:<%=
|
52
|
+
params.require(:<%= singular_table_name %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
|
51
53
|
<%- end -%>
|
52
54
|
end
|
53
55
|
<%- end -%>
|
data/lib/responders.rb
CHANGED
data/lib/responders/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: responders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
84
|
rubyforge_project: responders
|
85
|
-
rubygems_version: 2.
|
85
|
+
rubygems_version: 2.4.2
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: A set of Rails responders to dry up your application
|