custom-template 0.1.5 → 0.1.6
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.
data/custom-template.gemspec
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
class <%= controller_class_name %>Controller < ApplicationController
|
3
|
-
|
4
3
|
#-------#
|
5
4
|
# index #
|
6
5
|
#-------#
|
@@ -11,8 +10,8 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
11
10
|
#------#
|
12
11
|
# show #
|
13
12
|
#------#
|
14
|
-
def show
|
15
|
-
@<%= singular_table_name %> = <%= "#{class_name}.where( id:
|
13
|
+
def show( id )
|
14
|
+
@<%= singular_table_name %> = <%= "#{class_name}.where( id: id, user_id: session[:user_id] ).first" %>
|
16
15
|
end
|
17
16
|
|
18
17
|
#-----#
|
@@ -25,15 +24,15 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
25
24
|
#------#
|
26
25
|
# edit #
|
27
26
|
#------#
|
28
|
-
def edit
|
29
|
-
@<%= singular_table_name %> = <%= "#{class_name}.where( id:
|
27
|
+
def edit( id )
|
28
|
+
@<%= singular_table_name %> = <%= "#{class_name}.where( id: id, user_id: session[:user_id] ).first" %>
|
30
29
|
end
|
31
30
|
|
32
31
|
#--------#
|
33
32
|
# create #
|
34
33
|
#--------#
|
35
|
-
def create
|
36
|
-
@<%= singular_table_name %> = <%= orm_class.build( class_name, "
|
34
|
+
def create( <%= singular_table_name %> )
|
35
|
+
@<%= singular_table_name %> = <%= orm_class.build( class_name, " #{singular_table_name} " ) %>
|
37
36
|
@<%= "#{singular_table_name}.user_id" %> = <%= "session[:user_id]" %>
|
38
37
|
|
39
38
|
if @<%= orm_instance.save %>
|
@@ -46,24 +45,23 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
46
45
|
#--------#
|
47
46
|
# update #
|
48
47
|
#--------#
|
49
|
-
def update
|
50
|
-
@<%= singular_table_name %> = <%= "#{class_name}.where( id:
|
48
|
+
def update( id, <%= singular_table_name %> )
|
49
|
+
@<%= singular_table_name %> = <%= "#{class_name}.where( id: id, user_id: session[:user_id] ).first" %>
|
51
50
|
|
52
|
-
if @<%= orm_instance.update_attributes("
|
51
|
+
if @<%= orm_instance.update_attributes(" #{singular_table_name} ") %>
|
53
52
|
redirect_to( <%= singular_table_name %>_path( @<%= singular_table_name %> ), notice: <%= "\"#{human_name} was successfully updated.\"" %> )
|
54
53
|
else
|
55
|
-
render action: "edit", id: <%= "
|
54
|
+
render action: "edit", id: <%= "id" %>
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
59
58
|
#---------#
|
60
59
|
# destroy #
|
61
60
|
#---------#
|
62
|
-
def destroy
|
63
|
-
@<%= singular_table_name %> = <%= "#{class_name}.where( id:
|
61
|
+
def destroy( id )
|
62
|
+
@<%= singular_table_name %> = <%= "#{class_name}.where( id: id, user_id: session[:user_id] ).first" %>
|
64
63
|
@<%= orm_instance.destroy %>
|
65
64
|
|
66
65
|
redirect_to <%= plural_table_name %>_path
|
67
66
|
end
|
68
|
-
|
69
67
|
end
|
data/lib/custom-template.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: custom-template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-14 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Custom Template for Scaffold.
|
15
15
|
email:
|