starter_generators 0.5.1 → 0.5.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: 4e7e3cc8a55a31819442bb27a35aff456b56c448
4
- data.tar.gz: feee147493243aca31a44b028d4dddfd8831c6f5
3
+ metadata.gz: aaa8377c1c0ed5ec97662a5ec74cc24815cd2ebd
4
+ data.tar.gz: 6724467de33aab1e1eca437e018d8d219d2647da
5
5
  SHA512:
6
- metadata.gz: acd1682e3423b62bdd1468475038d81cfd54095ff41bed39db8f1c7cc3dc74f246fa5ba688c62f1e2f4b66b6e3e7e402ad30f1d9eef87bc57dd3e5f897ec0825
7
- data.tar.gz: edcfc78b829e15cb7fd954a4a0da24cb1db86b6fda1f599785b63d0ee43e233e50e4b2edf36b5a191e4f56f4f5871f2f57b835a0228da35786c21edff585d57f
6
+ metadata.gz: f28097700b8e54716d83699d5379e813759cca0d244ad46d251d3a25638847df84ee945ddce9a3509c654b561dca8f6185b68414ddf88ebf8eb8d05ddd23d9b1
7
+ data.tar.gz: a8c7bdc3638b4e318d49d41c86f82a01a3cf962d102dbac28ce64975519315128135dc0f4d65e04aa6a9e00063f4333ce96a217b43964579e58345bbd0c173f1
@@ -17,15 +17,19 @@ class <%= plural_name.camelize %>Controller < ApplicationController
17
17
  <% attributes.each do |attribute| -%>
18
18
  @<%= singular_name.underscore %>.<%= attribute.name %> = params[:<%= attribute.name %>]
19
19
  <% end %>
20
+ <% if named_routes? -%>
20
21
  if @<%= singular_name.underscore %>.save
21
- <% if named_routes? -%>
22
22
  redirect_to <%= plural_name %>_url
23
- <% else -%>
23
+ else
24
+ render 'new'
25
+ end
26
+ <% else -%>
27
+ if @<%= singular_name.underscore %>.save
24
28
  redirect_to "/<%= plural_name %>"
25
- <% end -%>
26
29
  else
27
30
  render 'new'
28
31
  end
32
+ <% end -%>
29
33
  end
30
34
 
31
35
  def edit
@@ -37,24 +41,28 @@ class <%= plural_name.camelize %>Controller < ApplicationController
37
41
  <% attributes.each do |attribute| -%>
38
42
  @<%= singular_name.underscore %>.<%= attribute.name %> = params[:<%= attribute.name %>]
39
43
  <% end %>
44
+ <% if named_routes? -%>
40
45
  if @<%= singular_name.underscore %>.save
41
- <% if named_routes? -%>
42
46
  redirect_to <%= plural_name %>_url
43
- <% else -%>
47
+ else
48
+ render 'new'
49
+ end
50
+ <% else -%>
51
+ if @<%= singular_name.underscore %>.save
44
52
  redirect_to "/<%= plural_name %>"
45
- <% end -%>
46
53
  else
47
- render 'edit'
54
+ render 'new'
48
55
  end
56
+ <% end -%>
49
57
  end
50
58
 
51
59
  def destroy
52
60
  @<%= singular_name.underscore %> = <%= class_name %>.find_by_id(params[:id])
53
61
  @<%= singular_name.underscore %>.destroy
54
- <% if named_routes? -%>
62
+ <% if named_routes? -%>
55
63
  redirect_to <%= plural_name %>_url
56
- <% else -%>
64
+ <% else -%>
57
65
  redirect_to "/<%= plural_name %>"
58
- <% end -%>
66
+ <% end -%>
59
67
  end
60
68
  end
@@ -9,10 +9,13 @@
9
9
  <% attributes.each do |attribute| -%>
10
10
  <div>
11
11
  <%%= label_tag :<%= attribute.name %> %><br />
12
+ <% if attribute.field_type == 'date' -%>
13
+ <%%= text_field_tag <%= attribute.name %> %>
14
+ <% end -%>
12
15
  <%%= <%= attribute.field_type %>_tag :<%= attribute.name %><%= "?" if attribute.type == :boolean %> %>
13
16
  </div>
14
17
 
15
- <% end %>
18
+ <% end %>
16
19
  <div>
17
20
  <%%= submit_tag "Create <%= human_name.titleize %>" %>
18
21
  </div>
@@ -1,3 +1,3 @@
1
1
  module StarterGenerators
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: starter_generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Cohen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-29 00:00:00.000000000 Z
11
+ date: 2013-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler