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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad1b6b744c9aa55914a6e164cc801dc529a25851
4
- data.tar.gz: 92b9dbeee18cd3d9952091699514eec067859efc
3
+ metadata.gz: d10c5ba8c6762f3d9554a9474cf02f8b4c1a0e20
4
+ data.tar.gz: 5b9a35e9669c0219287450813a7f6dbeeae1df5b
5
5
  SHA512:
6
- metadata.gz: 815b226588f75862a3aeabe3c1f754ec27224ac89de67570533a064fe2de15b9e3c58cecdf8a103be1c7887c686a8a0432fbd4100d14ba611ae62140a31974f0
7
- data.tar.gz: d4869f4248824bd15ce3ea2291a3908dd0d643fe670b3a29506da17bc0c70fa9411d48f068d84a8ffe33ed3f7543b6469f65fbad186421edf4ccd7facd1b8d69
6
+ metadata.gz: 0514aae5e8307def2b6c6be5970ffaae0195ae50cb6880314dd25e68ee9cf4b3bdcfed65ff18193a08ab53488b4517319ddb66cc4abd6051e11ad05efb9b1052
7
+ data.tar.gz: 93db7f8e08401a53d6f0e79f894e2858d59f1ca231293f5b2821b94ce6eee05e83c305cb4ad69fbbefb71e718b6ceae7000fc3b9c02795a72320aa8106fdef0f
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- ## 1.1.0
1
+ ## 1.1.2
2
+
3
+ * Improve support for namespaced models on the scaffold generator.
4
+ * Add default `respond_to` in scaffold template.
5
+ * Fix require of Action Controller.
6
+
7
+ ## 1.1.1
2
8
 
3
9
  * Lock Rails requirement to < 4.2.
4
10
 
@@ -1,53 +1,55 @@
1
1
  <% module_namespacing do -%>
2
2
  class <%= controller_class_name %>Controller < ApplicationController
3
- <%= controller_before_filter %> :set_<%= file_name %>, only: [:show, :edit, :update, :destroy]
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
- @<%= table_name %> = <%= orm_class.all(class_name) %>
8
- respond_with(@<%= table_name %>)
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(@<%= file_name %>)
15
+ respond_with(@<%= singular_table_name %>)
14
16
  end
15
17
 
16
18
  def new
17
- @<%= file_name %> = <%= orm_class.build(class_name) %>
18
- respond_with(@<%= file_name %>)
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
- @<%= file_name %> = <%= orm_class.build(class_name, attributes_params) %>
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(@<%= file_name %>)
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(@<%= file_name %>)
34
+ respond_with(@<%= singular_table_name %>)
33
35
  end
34
36
 
35
37
  def destroy
36
38
  @<%= orm_instance.destroy %>
37
- respond_with(@<%= file_name %>)
39
+ respond_with(@<%= singular_table_name %>)
38
40
  end
39
41
 
40
42
  private
41
- def set_<%= file_name %>
42
- @<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %>
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 <%= "#{file_name}_params" %>
48
+ def <%= "#{singular_table_name}_params" %>
47
49
  <%- if attributes_names.empty? -%>
48
- params[:<%= file_name %>]
50
+ params[:<%= singular_table_name %>]
49
51
  <%- else -%>
50
- params.require(:<%= file_name %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
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
@@ -1,4 +1,4 @@
1
- require 'action_controller/base'
1
+ require 'action_controller'
2
2
 
3
3
  module Responders
4
4
  autoload :FlashResponder, 'responders/flash_responder'
@@ -1,3 +1,3 @@
1
1
  module Responders
2
- VERSION = "1.1.1".freeze
2
+ VERSION = "1.1.2".freeze
3
3
  end
data/test/test_helper.rb CHANGED
@@ -6,7 +6,6 @@ require 'mocha/setup'
6
6
  ENV["RAILS_ENV"] = "test"
7
7
 
8
8
  require 'active_support'
9
- require 'action_controller'
10
9
  require 'active_model'
11
10
  require 'rails/engine'
12
11
  require 'rails/railtie'
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.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-08-18 00:00:00.000000000 Z
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.3.0
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