nested_scaffold 0.2.0 → 0.2.1

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.
@@ -1,84 +1,90 @@
1
1
  class <%= controller_class_name %>Controller < ApplicationController
2
2
  # GET <%= plural_nested_parent_name %>/1/<%= plural_name %>
3
- # GET <%= plural_nested_parent_name %>/1/<%= plural_name %>.xml
3
+ # GET <%= plural_nested_parent_name %>/1/<%= plural_name %>.json
4
4
  def index
5
- <%= "@#{plural_name} = #{nested_parent_class_name}.find(params[:#{nested_parent_id}]).#{plural_name}" %>
5
+ @<%= nested_parent_name %> = <%= orm_class.find(nested_parent_class_name, "params[:#{nested_parent_id}]") %>
6
+ <%= "@#{plural_name} = @#{nested_parent_name}.#{plural_name}" %>
6
7
 
7
8
  respond_to do |format|
8
9
  format.html # index.html.erb
9
- format.xml { render :xml => @<%= plural_name %> }
10
+ format.json { render :json => @<%= plural_name %> }
10
11
  end
11
12
  end
12
13
 
13
14
  # GET <%= plural_nested_parent_name %>/1/<%= plural_name %>/1
14
- # GET <%= plural_nested_parent_name %>/1/<%= plural_name %>/1.xml
15
+ # GET <%= plural_nested_parent_name %>/1/<%= plural_name %>/1.json
15
16
  def show
16
- <%= "@#{singular_name} = #{nested_parent_class_name}.find(params[:#{nested_parent_id}]).#{plural_name}.find(params[:id])" %>
17
+ @<%= nested_parent_name %> = <%= orm_class.find(nested_parent_class_name, "params[:#{nested_parent_id}]") %>
18
+ <%= "@#{singular_name} = @#{nested_parent_name}.#{plural_name}.find(params[:id])" %>
17
19
 
18
20
  respond_to do |format|
19
21
  format.html # show.html.erb
20
- format.xml { render :xml => @<%= singular_name %> }
22
+ format.json { render :json => @<%= singular_name %> }
21
23
  end
22
24
  end
23
25
 
24
26
  # GET <%= plural_nested_parent_name %>/1/<%= plural_name %>/new
25
- # GET <%= plural_nested_parent_name %>/1/<%= plural_name %>/new.xml
27
+ # GET <%= plural_nested_parent_name %>/1/<%= plural_name %>/new.json
26
28
  def new
27
- <%= "@#{singular_name} = #{nested_parent_class_name}.find(params[:#{nested_parent_id}]).#{plural_name}.build" %>
29
+ @<%= nested_parent_name %> = <%= orm_class.find(nested_parent_class_name, "params[:#{nested_parent_id}]") %>
30
+ <%= "@#{singular_name} = @#{nested_parent_name}.#{plural_name}.build" %>
28
31
 
29
32
  respond_to do |format|
30
33
  format.html # new.html.erb
31
- format.xml { render :xml => @<%= singular_name %> }
34
+ format.json { render :json => @<%= singular_name %> }
32
35
  end
33
36
  end
34
37
 
35
38
  # GET <%= plural_nested_parent_name %>/1/<%= plural_name %>/1/edit
36
39
  def edit
37
- <%= "@#{singular_name} = #{nested_parent_class_name}.find(params[:#{nested_parent_id}]).#{plural_name}.find(params[:id])" %>
40
+ @<%= nested_parent_name %> = <%= orm_class.find(nested_parent_class_name, "params[:#{nested_parent_id}]") %>
41
+ <%= "@#{singular_name} = @#{nested_parent_name}.#{plural_name}.find(params[:id])" %>
38
42
  end
39
43
 
40
44
  # POST <%= plural_nested_parent_name %>/1/<%= plural_name %>
41
- # POST <%= plural_nested_parent_name %>/1/<%= plural_name %>.xml
45
+ # POST <%= plural_nested_parent_name %>/1/<%= plural_name %>.json
42
46
  def create
43
- <%= "@#{singular_name} = #{nested_parent_class_name}.find(params[:#{nested_parent_id}]).#{plural_name}.build(params[:#{singular_name}])" %>
47
+ @<%= nested_parent_name %> = <%= orm_class.find(nested_parent_class_name, "params[:#{nested_parent_id}]") %>
48
+ <%= "@#{singular_name} = @#{nested_parent_name}.#{plural_name}.build(params[:#{singular_name}])" %>
44
49
 
45
50
  respond_to do |format|
46
51
  if @<%= singular_name %>.save
47
52
  format.html { redirect_to([@<%= singular_name %>.<%= nested_parent_name %>, @<%= singular_name %>], :notice => '<%= human_name %> was successfully created.') }
48
- format.xml { render :xml => @<%= singular_name %>, :status => :created, :location => [@<%= singular_name %>.<%= nested_parent_name %>, @<%= singular_name %>] }
53
+ format.json { render :json => @<%= singular_name %>, :status => :created, :location => [@<%= singular_name %>.<%= nested_parent_name %>, @<%= singular_name %>] }
49
54
  else
50
55
  format.html { render :action => "new" }
51
- format.xml { render :xml => @<%= singular_name %>.errors, :status => :unprocessable_entity }
56
+ format.json { render :json => @<%= singular_name %>.errors, :status => :unprocessable_entity }
52
57
  end
53
58
  end
54
59
  end
55
60
 
56
61
  # PUT <%= plural_nested_parent_name %>/1/<%= plural_name %>/1
57
- # PUT <%= plural_nested_parent_name %>/1/<%= plural_name %>/1.xml
62
+ # PUT <%= plural_nested_parent_name %>/1/<%= plural_name %>/1.json
58
63
  def update
59
- <%= "@#{singular_name} = #{nested_parent_class_name}.find(params[:#{nested_parent_id}]).#{plural_name}.find(params[:id])" %>
64
+ @<%= nested_parent_name %> = <%= orm_class.find(nested_parent_class_name, "params[:#{nested_parent_id}]") %>
65
+ <%= "@#{singular_name} = @#{nested_parent_name}.#{plural_name}.find(params[:id])" %>
60
66
 
61
67
  respond_to do |format|
62
68
  if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
63
69
  format.html { redirect_to([@<%= singular_name %>.<%= nested_parent_name %>, @<%= singular_name %>], :notice => '<%= human_name %> was successfully updated.') }
64
- format.xml { head :ok }
70
+ format.json { head :ok }
65
71
  else
66
72
  format.html { render :action => "edit" }
67
- format.xml { render :xml => @<%= singular_name %>.errors, :status => :unprocessable_entity }
73
+ format.json { render :json => @<%= singular_name %>.errors, :status => :unprocessable_entity }
68
74
  end
69
75
  end
70
76
  end
71
77
 
72
78
  # DELETE <%= plural_nested_parent_name %>/1/<%= plural_name %>/1
73
- # DELETE <%= plural_nested_parent_name %>/1/<%= plural_name %>/1.xml
79
+ # DELETE <%= plural_nested_parent_name %>/1/<%= plural_name %>/1.json
74
80
  def destroy
75
- <%= "#{nested_parent_name} = #{nested_parent_class_name}.find(params[:#{nested_parent_id}])" %>
76
- <%= "@#{singular_name} = #{nested_parent_name}.#{plural_name}.find(params[:id])" %>
81
+ @<%= nested_parent_name %> = <%= orm_class.find(nested_parent_class_name, "params[:#{nested_parent_id}]") %>
82
+ <%= "@#{singular_name} = @#{nested_parent_name}.#{plural_name}.find(params[:id])" %>
77
83
  @<%= singular_name %>.destroy
78
84
 
79
85
  respond_to do |format|
80
86
  format.html { redirect_to <%= nested_parent_name %>_<%= index_helper %>_url(<%= nested_parent_name %>) }
81
- format.xml { head :ok }
87
+ format.json { head :ok }
82
88
  end
83
89
  end
84
90
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nested_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2010-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70301992000680 !ruby/object:Gem::Requirement
16
+ requirement: &70184308227520 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.2.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70301992000680
24
+ version_requirements: *70184308227520
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &70301992000080 !ruby/object:Gem::Requirement
27
+ requirement: &70184308225620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70301992000080
35
+ version_requirements: *70184308225620
36
36
  description: Nested scaffold generator for Rails 3.2
37
37
  email: ronnie@dio.jp
38
38
  executables: []
@@ -131,7 +131,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  segments:
133
133
  - 0
134
- hash: -2614737212560928925
134
+ hash: 4091906991971113874
135
135
  required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  none: false
137
137
  requirements: