mack-data_mapper 0.5.5 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -0
- data/lib/database.rb +94 -0
- data/lib/dm_patches/confirmation_validation.rb +19 -0
- data/lib/dm_patches/dm-cli.rb +1 -0
- data/lib/dm_patches/migrations.rb +23 -0
- data/lib/dm_patches/pooling.rb +229 -0
- data/lib/genosaurus_helpers.rb +40 -0
- data/lib/helpers/orm_helpers.rb +50 -21
- data/lib/mack-data_mapper.rb +43 -16
- data/lib/migration_generator/migration_generator.rb +28 -17
- data/lib/migration_generator/templates/db/migrations/%=@migration_name%.rb.template +6 -6
- data/lib/model_column.rb +42 -0
- data/lib/model_generator/manifest.yml +9 -2
- data/lib/model_generator/model_generator.rb +25 -20
- data/lib/model_generator/templates/model.rb.template +4 -4
- data/lib/model_generator/templates/rspec.rb.template +7 -0
- data/lib/model_generator/templates/{test.rb.template → test_case.rb.template} +0 -0
- data/lib/resource.rb +17 -0
- data/lib/runner.rb +17 -0
- data/lib/scaffold_generator/manifest.yml +14 -3
- data/lib/scaffold_generator/scaffold_generator.rb +4 -4
- data/lib/scaffold_generator/templates/app/controllers/controller.rb.template +10 -9
- data/lib/scaffold_generator/templates/app/helpers/controllers/helper.rb.template +7 -0
- data/lib/scaffold_generator/templates/app/views/edit.html.erb.template +1 -1
- data/lib/scaffold_generator/templates/app/views/new.html.erb.template +1 -1
- data/lib/scaffold_generator/templates/test/functional/rspec.rb.template +47 -0
- data/lib/scaffold_generator/templates/{test.rb.template → test/functional/test_case.rb.template} +0 -0
- data/lib/tasks/db_create_drop_tasks.rake +43 -62
- data/lib/tasks/db_migration_tasks.rake +25 -62
- data/lib/tasks/test_tasks.rake +12 -0
- data/lib/test_extensions.rb +90 -0
- metadata +28 -52
- data/lib/configuration.rb +0 -22
- data/lib/persistence.rb +0 -9
- data/test/database.yml +0 -3
- data/test/fixtures/add_users_migration.rb.fixture +0 -9
- data/test/fixtures/album.rb.fixture +0 -4
- data/test/fixtures/album_unit_test.rb.fixture +0 -9
- data/test/fixtures/album_with_cols.rb.fixture +0 -7
- data/test/fixtures/create_users_migration.rb.fixture +0 -12
- data/test/fixtures/routes.rb.fixture +0 -3
- data/test/fixtures/zoo_no_cols/edit.html.erb.fixture +0 -11
- data/test/fixtures/zoo_no_cols/index.html.erb.fixture +0 -20
- data/test/fixtures/zoo_no_cols/new.html.erb.fixture +0 -11
- data/test/fixtures/zoo_no_cols/show.html.erb.fixture +0 -6
- data/test/fixtures/zoo_with_cols/edit.html.erb.fixture +0 -19
- data/test/fixtures/zoo_with_cols/index.html.erb.fixture +0 -26
- data/test/fixtures/zoo_with_cols/new.html.erb.fixture +0 -19
- data/test/fixtures/zoo_with_cols/show.html.erb.fixture +0 -22
- data/test/fixtures/zoo_with_cols/zoo.rb.fixture +0 -4
- data/test/fixtures/zoo_with_cols/zoos_controller.rb.fixture +0 -50
- data/test/generators/migration_generator_test.rb +0 -71
- data/test/generators/model_generator_test.rb +0 -37
- data/test/generators/scaffold_generator_test.rb +0 -61
- data/test/lib/user.rb +0 -6
- data/test/tasks/db_migration_tasks_test.rb +0 -57
- data/test/test_helper.rb +0 -77
data/lib/mack-data_mapper.rb
CHANGED
@@ -1,25 +1,52 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'genosaurus'
|
3
|
-
require 'erubis'
|
4
|
-
begin
|
5
|
-
require 'mack-orm_common'
|
6
|
-
rescue Exception => e
|
7
|
-
end
|
8
3
|
|
9
|
-
gem
|
4
|
+
# gem 'dm-core', '0.9.2'
|
5
|
+
# require 'dm-core'
|
6
|
+
# gem 'dm-validations', '0.9.2'
|
7
|
+
# require 'dm-validations'
|
8
|
+
# gem 'dm-migrations', '0.9.2'
|
9
|
+
# require 'dm-migrations'
|
10
|
+
$: << File.expand_path(File.join(File.dirname(__FILE__), "dm_patches"))
|
10
11
|
require 'data_mapper'
|
11
12
|
|
12
13
|
fl = File.dirname(__FILE__)
|
13
|
-
require File.join(fl, "
|
14
|
-
require File.join(fl, "
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
require File.join(fl, "database")
|
15
|
+
require File.join(fl, "helpers", "orm_helpers")
|
16
|
+
require File.join(fl, "resource")
|
17
|
+
require File.join(fl, "runner")
|
18
|
+
require File.join(fl, "test_extensions")
|
19
|
+
|
20
|
+
require File.join(fl, "model_column")
|
21
|
+
require File.join(fl, "genosaurus_helpers")
|
21
22
|
|
22
|
-
|
23
|
+
|
24
|
+
[:helpers, :migration_generator, :model_generator, :scaffold_generator, :dm_patches].each do |folder|
|
23
25
|
Dir.glob(File.join(File.dirname(__FILE__), folder.to_s, "**/*.rb")).each {|f| require f}
|
24
26
|
end
|
25
|
-
|
27
|
+
|
28
|
+
English::Inflect.word 'email_address'
|
29
|
+
English::Inflect.word 'address'
|
30
|
+
|
31
|
+
module DataMapper # :nodoc:
|
32
|
+
class Logger # :nodoc:
|
33
|
+
|
34
|
+
[:debug, :info, :warn, :error, :fatal].each do |m|
|
35
|
+
unless method_defined?("dm_#{m}")
|
36
|
+
eval %{
|
37
|
+
alias_method :dm_#{m}, :#{m}
|
38
|
+
|
39
|
+
def #{m}(message)
|
40
|
+
Mack.logger.#{m}(message)
|
41
|
+
dm_#{m}(message)
|
42
|
+
end
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
DataMapper.logger = DataMapper::Logger.new(StringIO.new, 0)
|
51
|
+
|
52
|
+
Mack::Database.establish_connection(Mack.env)
|
@@ -4,28 +4,30 @@
|
|
4
4
|
# rake generate:migration name=create_users
|
5
5
|
#
|
6
6
|
# db/migrations/<number>_create_users.rb:
|
7
|
-
#
|
8
|
-
#
|
7
|
+
# migration <number>, :create_users do
|
8
|
+
# up do
|
9
9
|
# end
|
10
|
-
#
|
11
|
-
#
|
10
|
+
#
|
11
|
+
# down do
|
12
12
|
# end
|
13
13
|
# end
|
14
14
|
#
|
15
15
|
# Example with columns:
|
16
|
-
# rake generate:migration name=create_users cols=username:string,email_address:string,created_at:
|
16
|
+
# rake generate:migration name=create_users cols=username:string,email_address:string,created_at:date_time,updated_at:date_time
|
17
17
|
#
|
18
18
|
# db/migrations/<number>_create_users.rb:
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# create_table :users do
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
19
|
+
# migration <number>, :create_users do
|
20
|
+
# up do
|
21
|
+
# create_table :users do
|
22
|
+
# column :id, Integer, :serial => true
|
23
|
+
# column :username, String, :size => 50
|
24
|
+
# column :email, String, :size => 50
|
25
|
+
# column :created_at, DateTime
|
26
|
+
# column :updated_at, DateTime
|
27
|
+
# end
|
26
28
|
# end
|
27
|
-
#
|
28
|
-
#
|
29
|
+
#
|
30
|
+
# down do
|
29
31
|
# drop_table :users
|
30
32
|
# end
|
31
33
|
# end
|
@@ -33,9 +35,18 @@ class MigrationGenerator < Genosaurus
|
|
33
35
|
|
34
36
|
require_param :name
|
35
37
|
|
36
|
-
def setup
|
37
|
-
@table_name = param(:name).underscore.
|
38
|
-
@
|
38
|
+
def setup # :nodoc:
|
39
|
+
@table_name = param(:name).underscore.gsub("create_", "")
|
40
|
+
@current_migration_number = next_migration_number
|
41
|
+
@migration_name = "#{@current_migration_number}_#{param(:name).underscore}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def migration_columns # :nodoc:
|
45
|
+
[Mack::Genosaurus::DataMapper::ModelColumn.new(param(:name), "id:serial"), columns].flatten
|
46
|
+
end
|
47
|
+
|
48
|
+
def get_column_type(column) # :nodoc:
|
49
|
+
column.column_type.camelcase
|
39
50
|
end
|
40
51
|
|
41
52
|
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
|
1
|
+
migration <%= @current_migration_number.to_i %>, :<%= param(:name) %> do
|
2
2
|
|
3
|
-
|
3
|
+
up do
|
4
4
|
<%
|
5
5
|
unless columns.empty?
|
6
6
|
-%>
|
7
|
-
create_table :<%= @table_name %> do
|
7
|
+
create_table :<%= @table_name %> do
|
8
8
|
<%
|
9
|
-
for column in
|
9
|
+
for column in migration_columns
|
10
10
|
-%>
|
11
|
-
|
11
|
+
column :<%= column.column_name %>, <%= get_column_type(column) %>
|
12
12
|
<%
|
13
13
|
end
|
14
14
|
-%>
|
@@ -18,7 +18,7 @@ class <%= param(:name).camelcase %> < DataMapper::Migration
|
|
18
18
|
-%>
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
down do
|
22
22
|
<%
|
23
23
|
unless columns.empty?
|
24
24
|
-%>
|
data/lib/model_column.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
module Mack
|
2
|
+
module Genosaurus
|
3
|
+
module DataMapper
|
4
|
+
# Used to represent a 'column' from the param cols or columns for generators.
|
5
|
+
class ModelColumn
|
6
|
+
|
7
|
+
# The name of the column.
|
8
|
+
attr_accessor :column_name
|
9
|
+
# The type of the column. Ie. string, integer, datetime, etc...
|
10
|
+
attr_accessor :column_type
|
11
|
+
# The name of the model associated with the column. Ie. user, post, etc...
|
12
|
+
attr_accessor :model_name
|
13
|
+
|
14
|
+
# Takes in the model_name (user, post, etc...) and the column (username:string, body:text, etc...)
|
15
|
+
def initialize(model_name, column_unsplit)
|
16
|
+
self.model_name = model_name.singular.underscore
|
17
|
+
cols = column_unsplit.split(":")
|
18
|
+
self.column_name = cols.first#.underscore
|
19
|
+
self.column_type = cols.last#.underscore
|
20
|
+
end
|
21
|
+
|
22
|
+
# Generates the appropriate HTML form field for the type of column represented.
|
23
|
+
#
|
24
|
+
# Examples:
|
25
|
+
# Mack::Generator::ColumnObject.new("user", "username:string").form_field
|
26
|
+
# => "<%= model_text_field(@user, :username) %>"
|
27
|
+
# Mack::Generator::ColumnObject.new("Post", "body:text").form_field
|
28
|
+
# => "<%= model_textarea(@user, :username) %>"
|
29
|
+
def form_field
|
30
|
+
case self.column_type
|
31
|
+
when "text"
|
32
|
+
%{<%= model_textarea(@#{self.model_name}, :#{self.column_name}) %>}
|
33
|
+
else
|
34
|
+
%{<%= model_text_field(@#{self.model_name}, :#{self.column_name}) %>}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end # ModelColumn
|
39
|
+
end # DataMapper
|
40
|
+
|
41
|
+
end # Generator
|
42
|
+
end # Mack
|
@@ -5,7 +5,14 @@ model_template:
|
|
5
5
|
type: file
|
6
6
|
template_path: <%= File.join(templates_directory_path, "model.rb.template") %>
|
7
7
|
output_path: <%= File.join("app", "models", "#{param(:name).singular.underscore}.rb") %>
|
8
|
+
<% if app_config.mack.testing_framework == "test_case" -%>
|
8
9
|
test_template:
|
9
10
|
type: file
|
10
|
-
template_path: <%= File.join(templates_directory_path, "
|
11
|
-
output_path: <%= File.join("test", "unit", "#{param(:name).singular.underscore}_test.rb") %>
|
11
|
+
template_path: <%= File.join(templates_directory_path, "test_case.rb.template") %>
|
12
|
+
output_path: <%= File.join("test", "unit", "#{param(:name).singular.underscore}_test.rb") %>
|
13
|
+
<% elsif app_config.mack.testing_framework == "rspec" -%>
|
14
|
+
test_template:
|
15
|
+
type: file
|
16
|
+
template_path: <%= File.join(templates_directory_path, "rspec.rb.template") %>
|
17
|
+
output_path: <%= File.join("test", "unit", "#{param(:name).singular.underscore}_spec.rb") %>
|
18
|
+
<% end -%>
|
@@ -5,15 +5,15 @@
|
|
5
5
|
#
|
6
6
|
# app/models/user.rb:
|
7
7
|
# class User
|
8
|
-
# include DataMapper::
|
8
|
+
# include DataMapper::Resource
|
9
9
|
#
|
10
10
|
# end
|
11
11
|
# db/migrations/<number>_create_users.rb:
|
12
|
-
#
|
13
|
-
#
|
12
|
+
# migration <number>, :create_users do
|
13
|
+
# up do
|
14
14
|
# end
|
15
|
-
#
|
16
|
-
#
|
15
|
+
#
|
16
|
+
# down do
|
17
17
|
# end
|
18
18
|
# end
|
19
19
|
#
|
@@ -22,24 +22,25 @@
|
|
22
22
|
#
|
23
23
|
# app/models/user.rb:
|
24
24
|
# class User
|
25
|
-
# include DataMapper::
|
25
|
+
# include DataMapper::Resource
|
26
26
|
#
|
27
|
-
# property :username,
|
28
|
-
# property :email_address,
|
29
|
-
# property :created_at,
|
30
|
-
# property :updated_at,
|
27
|
+
# property :username, String
|
28
|
+
# property :email_address, String
|
29
|
+
# property :created_at, DateTime
|
30
|
+
# property :updated_at, DateTime
|
31
31
|
# end
|
32
32
|
# db/migrations/<number>_create_users.rb:
|
33
|
-
#
|
34
|
-
#
|
35
|
-
# create_table :users do
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
33
|
+
# migration <number>, :create_users do
|
34
|
+
# up do
|
35
|
+
# create_table :users do
|
36
|
+
# column :username, String, :size => 50
|
37
|
+
# column :email, String, :size => 50
|
38
|
+
# column :created_at, DateTime
|
39
|
+
# column :updated_at, DateTime
|
40
|
+
# end
|
40
41
|
# end
|
41
|
-
#
|
42
|
-
#
|
42
|
+
#
|
43
|
+
# down do
|
43
44
|
# drop_table :users
|
44
45
|
# end
|
45
46
|
# end
|
@@ -47,8 +48,12 @@ class ModelGenerator < Genosaurus
|
|
47
48
|
|
48
49
|
require_param :name
|
49
50
|
|
50
|
-
def after_generate
|
51
|
+
def after_generate # :nodoc:
|
51
52
|
MigrationGenerator.run(@options.merge({"name" => "create_#{param(:name).plural}"}))
|
52
53
|
end
|
53
54
|
|
55
|
+
def migration_columns # :nodoc:
|
56
|
+
[Mack::Genosaurus::DataMapper::ModelColumn.new(param(:name), "id:serial"), columns].flatten
|
57
|
+
end
|
58
|
+
|
54
59
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class <%= param(:name).singular.camelcase %>
|
2
|
-
include DataMapper::
|
3
|
-
|
2
|
+
include DataMapper::Resource
|
3
|
+
|
4
4
|
<%
|
5
|
-
for column in
|
5
|
+
for column in migration_columns
|
6
6
|
-%>
|
7
|
-
property :<%= column.column_name %>,
|
7
|
+
property :<%= column.column_name %>, <%= column.column_type.camelcase %>
|
8
8
|
<%
|
9
9
|
end
|
10
10
|
-%>
|
File without changes
|
data/lib/resource.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module DataMapper
|
2
|
+
module Resource
|
3
|
+
|
4
|
+
# Returns the key of the DataMapper::Resource object when passed into a url helper
|
5
|
+
#
|
6
|
+
# Example:
|
7
|
+
# class User
|
8
|
+
# include DataMapper::Resource
|
9
|
+
# property :name, String, :key => true
|
10
|
+
# end
|
11
|
+
# users_show_url(User.new(:username => "markbates")) # => /users/markbates
|
12
|
+
def to_param
|
13
|
+
self.key
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
data/lib/runner.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#--
|
2
|
+
# module Mack
|
3
|
+
# class Runner
|
4
|
+
#
|
5
|
+
# alias_method :data_mapper_custom_dispatch_wrapper, :custom_dispatch_wrapper# if self.respond_to? :custom_dispatch_wrapper
|
6
|
+
#
|
7
|
+
# # Wrap all requests in a 'default' DataMapper repository block.
|
8
|
+
# def custom_dispatch_wrapper(&block)
|
9
|
+
# repo = (app_config.mack.default_respository_name || "default").to_sym
|
10
|
+
# repository(repo) do
|
11
|
+
# data_mapper_custom_dispatch_wrapper(&block)
|
12
|
+
# end
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# end # Runner
|
16
|
+
# end # Mack
|
17
|
+
#++
|
@@ -18,7 +18,18 @@ show_template:
|
|
18
18
|
type: file
|
19
19
|
template_path: <%= File.join(templates_directory_path, "app", "views", "show.html.erb.template") %>
|
20
20
|
output_path: <%= File.join("app", "views", @name_plural, "show.html.erb") %>
|
21
|
-
|
21
|
+
helper_template:
|
22
22
|
type: file
|
23
|
-
template_path: <%= File.join(templates_directory_path, "
|
24
|
-
output_path: <%= File.join("
|
23
|
+
template_path: <%= File.join(templates_directory_path, "app", "helpers", "controllers", "helper.rb.template") %>
|
24
|
+
output_path: <%= File.join("app", "helpers", "controllers", "#{@name_plural}_controller_helper.rb") %>
|
25
|
+
<% if app_config.mack.testing_framework == "test_case" -%>
|
26
|
+
functional_test_template:
|
27
|
+
type: file
|
28
|
+
template_path: <%= File.join(templates_directory_path, "test", "functional", "test_case.rb.template") %>
|
29
|
+
output_path: <%= File.join("test", "functional", "#{@name_plural}_controller_test.rb") %>
|
30
|
+
<% elsif app_config.mack.testing_framework == "rspec" -%>
|
31
|
+
functional_test_template:
|
32
|
+
type: file
|
33
|
+
template_path: <%= File.join(templates_directory_path, "test", "functional", "rspec.rb.template") %>
|
34
|
+
output_path: <%= File.join("test", "functional", "#{@name_plural}_controller_spec.rb") %>
|
35
|
+
<% end -%>
|
@@ -6,21 +6,21 @@ class ScaffoldGenerator < Genosaurus
|
|
6
6
|
|
7
7
|
require_param :name
|
8
8
|
|
9
|
-
def setup
|
9
|
+
def setup # :nodoc:
|
10
10
|
@name_singular = param(:name).singular.underscore
|
11
11
|
@name_plural = param(:name).plural.underscore
|
12
12
|
@name_singular_camel = @name_singular.camelcase
|
13
13
|
@name_plural_camel = @name_plural.camelcase
|
14
14
|
end
|
15
15
|
|
16
|
-
def after_generate
|
16
|
+
def after_generate # :nodoc:
|
17
17
|
ModelGenerator.run(@options)
|
18
18
|
update_routes_file
|
19
19
|
end
|
20
20
|
|
21
|
-
def update_routes_file
|
21
|
+
def update_routes_file # :nodoc:
|
22
22
|
# update routes.rb
|
23
|
-
routes = File.join(Mack
|
23
|
+
routes = File.join(Mack.root, "config", "routes.rb")
|
24
24
|
rf = File.open(routes).read
|
25
25
|
unless rf.match(".resource :#{@name_plural}")
|
26
26
|
puts "Updating routes.rb"
|
@@ -1,5 +1,6 @@
|
|
1
|
-
class <%= @name_plural_camel %>Controller
|
2
|
-
|
1
|
+
class <%= @name_plural_camel %>Controller
|
2
|
+
include Mack::Controller
|
3
|
+
|
3
4
|
# GET /<%= @name_plural %>
|
4
5
|
def index
|
5
6
|
@<%= @name_plural %> = <%= @name_singular_camel %>.all
|
@@ -7,7 +8,7 @@ class <%= @name_plural_camel %>Controller < Mack::Controller::Base
|
|
7
8
|
|
8
9
|
# GET /<%= @name_plural %>/1
|
9
10
|
def show
|
10
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.
|
11
|
+
@<%= @name_singular %> = <%= @name_singular_camel %>.get(params[:id])
|
11
12
|
end
|
12
13
|
|
13
14
|
# GET /<%= @name_plural %>/new
|
@@ -17,12 +18,12 @@ class <%= @name_plural_camel %>Controller < Mack::Controller::Base
|
|
17
18
|
|
18
19
|
# GET /<%= @name_plural %>/1/edit
|
19
20
|
def edit
|
20
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.
|
21
|
+
@<%= @name_singular %> = <%= @name_singular_camel %>.get(params[:id])
|
21
22
|
end
|
22
23
|
|
23
24
|
# POST /<%= @name_plural %>
|
24
25
|
def create
|
25
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.new(params
|
26
|
+
@<%= @name_singular %> = <%= @name_singular_camel %>.new(params[:<%= @name_singular %>])
|
26
27
|
if @<%= @name_singular %>.save
|
27
28
|
redirect_to(<%= @name_plural %>_show_url(:id => @<%= @name_singular %>))
|
28
29
|
else
|
@@ -32,8 +33,8 @@ class <%= @name_plural_camel %>Controller < Mack::Controller::Base
|
|
32
33
|
|
33
34
|
# PUT /<%= @name_plural %>/1
|
34
35
|
def update
|
35
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.
|
36
|
-
if @<%= @name_singular %>.update_attributes(params
|
36
|
+
@<%= @name_singular %> = <%= @name_singular_camel %>.get(params[:id])
|
37
|
+
if @<%= @name_singular %>.update_attributes(params[:<%= @name_singular %>])
|
37
38
|
redirect_to(<%= @name_plural %>_show_url(:id => @<%= @name_singular %>))
|
38
39
|
else
|
39
40
|
render(:action, "edit")
|
@@ -42,8 +43,8 @@ class <%= @name_plural_camel %>Controller < Mack::Controller::Base
|
|
42
43
|
|
43
44
|
# DELETE /<%= @name_plural %>/1
|
44
45
|
def delete
|
45
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.
|
46
|
-
@<%= @name_singular %>.destroy
|
46
|
+
@<%= @name_singular %> = <%= @name_singular_camel %>.get(params[:id])
|
47
|
+
@<%= @name_singular %>.destroy
|
47
48
|
redirect_to(<%= @name_plural %>_index_url)
|
48
49
|
end
|
49
50
|
|