custom-template 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,4 +14,6 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "custom-template"
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Custom::Template::VERSION
17
+
18
+ # gem.add_dependency 'action_args'
17
19
  end
@@ -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: params[:id], user_id: session[:user_id] ).first" %>
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: params[:id], user_id: session[:user_id] ).first" %>
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, " params[:#{singular_table_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: params[:id], user_id: session[:user_id] ).first" %>
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(" params[:#{singular_table_name}] ") %>
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: <%= "params[: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: params[:id], user_id: session[:user_id] ).first" %>
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
@@ -1,5 +1,5 @@
1
1
  module Custom
2
2
  module Template
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
@@ -2,6 +2,8 @@
2
2
  require "custom-template/version"
3
3
  require 'rails/generators'
4
4
 
5
+ #require 'action_args'
6
+
5
7
  module Custom
6
8
  module Generators
7
9
  class TemplateGenerator < ::Rails::Generators::Base
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.5
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-13 00:00:00.000000000 Z
12
+ date: 2012-10-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Custom Template for Scaffold.
15
15
  email: