mack 0.4.7 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +21 -2
- data/README +1 -4
- data/bin/mack +2 -2
- data/lib/errors/errors.rb +1 -10
- data/lib/generators/mack_application_generator/manifest.yml +5 -1
- data/lib/generators/mack_application_generator/templates/config/database.yml.template +45 -1
- data/lib/generators/mack_application_generator/templates/test/test_helper.rb.template +1 -1
- data/lib/generators/plugin_generator/templates/vendor/plugins/{<%= @plugin_name %> → %=@plugin_name%}/init.rb.template +0 -0
- data/lib/generators/plugin_generator/templates/vendor/plugins/{<%= @plugin_name %>/lib/<%= @plugin_name %>.rb.template → %=@plugin_name%/lib/%=@plugin_name%.rb.template} +0 -0
- data/lib/generators/plugin_generator/templates/vendor/plugins/{<%= @plugin_name %>/lib/tasks/<%= @plugin_name %>_tasks.rake.template → %=@plugin_name%/lib/tasks/%=@plugin_name%_tasks.rake.template} +0 -0
- data/lib/initialization/configuration.rb +28 -6
- data/lib/initialization/console.rb +2 -0
- data/lib/initialization/initializer.rb +23 -36
- data/lib/initialization/initializers/logging.rb +2 -2
- data/lib/initialization/initializers/orm_support.rb +4 -63
- data/lib/initialization/initializers/plugins.rb +1 -1
- data/lib/initialization/server/simple_server.rb +0 -2
- data/lib/mack.rb +2 -2
- data/lib/mack_tasks.rb +6 -0
- data/lib/rendering/base.rb +1 -1
- data/lib/rendering/classes/action.rb +1 -1
- data/lib/rendering/classes/public.rb +1 -1
- data/lib/rendering/classes/url.rb +1 -0
- data/lib/rendering/classes/xml.rb +1 -1
- data/lib/sea_level/controller_base.rb +19 -10
- data/lib/sea_level/helpers/view_helpers/html_helpers.rb +96 -11
- data/lib/sea_level/helpers/view_helpers/string_helpers.rb +22 -0
- data/lib/sea_level/uploaded_file.rb +1 -0
- data/lib/sea_level/view_binder.rb +14 -11
- data/lib/tasks/cachetastic_tasks.rake +11 -11
- data/lib/tasks/mack_server_tasks.rake +3 -3
- data/lib/tasks/mack_tasks.rake +2 -5
- data/lib/tasks/rake_rules.rake +1 -2
- data/lib/tasks/test_tasks.rake +22 -1
- data/lib/test_extensions/test_case.rb +50 -0
- data/lib/test_extensions/test_helpers.rb +22 -5
- metadata +30 -30
- data/lib/generators/genosaurus_helpers.rb +0 -38
- data/lib/generators/migration_generator/migration_generator.rb +0 -67
- data/lib/generators/migration_generator/templates/db/migrations/<%=@migration_name%>.rb.template +0 -31
- data/lib/generators/model_column.rb +0 -55
- data/lib/generators/model_generator/manifest.yml +0 -11
- data/lib/generators/model_generator/model_generator.rb +0 -93
- data/lib/generators/model_generator/templates/active_record.rb.template +0 -2
- data/lib/generators/model_generator/templates/data_mapper.rb.template +0 -11
- data/lib/generators/model_generator/templates/test.rb.template +0 -9
- data/lib/generators/scaffold_generator/manifest.yml +0 -31
- data/lib/generators/scaffold_generator/scaffold_generator.rb +0 -43
- data/lib/generators/scaffold_generator/templates/generic/app/controllers/controller.rb.template +0 -50
- data/lib/generators/scaffold_generator/templates/generic/app/views/edit.html.erb.template +0 -20
- data/lib/generators/scaffold_generator/templates/generic/app/views/index.html.erb.template +0 -41
- data/lib/generators/scaffold_generator/templates/generic/app/views/new.html.erb.template +0 -19
- data/lib/generators/scaffold_generator/templates/generic/app/views/show.html.erb.template +0 -12
- data/lib/generators/scaffold_generator/templates/no_orm/controller.rb.template +0 -38
- data/lib/generators/scaffold_generator/templates/test.rb.template +0 -9
- data/lib/sea_level/helpers/view_helpers/orm_helpers.rb +0 -87
- data/lib/tasks/db_tasks.rake +0 -94
- data/lib/utils/html.rb +0 -104
@@ -1,11 +0,0 @@
|
|
1
|
-
models_directory:
|
2
|
-
type: directory
|
3
|
-
output_path: <%= File.join("app", "models") %>
|
4
|
-
model_template:
|
5
|
-
type: file
|
6
|
-
template_path: <%= File.join(templates_directory_path, "#{app_config.orm}.rb.template") %>
|
7
|
-
output_path: <%= File.join("app", "models", "#{param(:name).singular.underscore}.rb") %>
|
8
|
-
test_template:
|
9
|
-
type: file
|
10
|
-
template_path: <%= File.join(templates_directory_path, "test.rb.template") %>
|
11
|
-
output_path: <%= File.join("test", "unit", "#{param(:name).singular.underscore}_test.rb") %>
|
@@ -1,93 +0,0 @@
|
|
1
|
-
# This will generate an ORM 'model' for your application based on the specified ORM you're using.
|
2
|
-
#
|
3
|
-
# Example without columns:
|
4
|
-
# rake generate:model name=user
|
5
|
-
# If using ActiveRecord generates:
|
6
|
-
# app/models/user.rb:
|
7
|
-
# class User < ActiveRecord::Base
|
8
|
-
# end
|
9
|
-
# db/migrations/<number>_create_users.rb:
|
10
|
-
# class CreateUsers < ActiveRecord::Migration
|
11
|
-
# self.up
|
12
|
-
# end
|
13
|
-
#
|
14
|
-
# self.down
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# If using DataMapper generates:
|
19
|
-
# app/models/user.rb:
|
20
|
-
# class User
|
21
|
-
# include DataMapper::Persistence
|
22
|
-
#
|
23
|
-
# end
|
24
|
-
# db/migrations/<number>_create_users.rb:
|
25
|
-
# class CreateUsers < DataMapper::Migration
|
26
|
-
# self.up
|
27
|
-
# end
|
28
|
-
#
|
29
|
-
# self.down
|
30
|
-
# end
|
31
|
-
# end
|
32
|
-
#
|
33
|
-
# Example with columns:
|
34
|
-
# rake generate:model name=user cols=username:string,email_address:string,created_at:datetime,updated_at:datetime
|
35
|
-
# If using ActiveRecord generates:
|
36
|
-
# app/models/user.rb:
|
37
|
-
# class User < ActiveRecord::Base
|
38
|
-
# end
|
39
|
-
# db/migrations/<number>_create_users.rb:
|
40
|
-
# class CreateUsers < ActiveRecord::Migration
|
41
|
-
# self.up
|
42
|
-
# create_table :users do |t|
|
43
|
-
# t.column :username, :string
|
44
|
-
# t.column :email_address, :string
|
45
|
-
# t.column :created_at, :datetime
|
46
|
-
# t.column :updated_at, :datetime
|
47
|
-
# end
|
48
|
-
#
|
49
|
-
# self.down
|
50
|
-
# drop_table :users
|
51
|
-
# end
|
52
|
-
# end
|
53
|
-
#
|
54
|
-
# If using DataMapper generates:
|
55
|
-
# app/models/user.rb:
|
56
|
-
# class User
|
57
|
-
# include DataMapper::Persistence
|
58
|
-
#
|
59
|
-
# property :username, :string
|
60
|
-
# property :email_address, :string
|
61
|
-
# property :created_at, :datetime
|
62
|
-
# property :updated_at, :datetime
|
63
|
-
# end
|
64
|
-
# db/migrations/<number>_create_users.rb:
|
65
|
-
# class CreateUsers < DataMapper::Migration
|
66
|
-
# self.up
|
67
|
-
# create_table :users do |t|
|
68
|
-
# t.column :username, :string
|
69
|
-
# t.column :email_address, :string
|
70
|
-
# t.column :created_at, :datetime
|
71
|
-
# t.column :updated_at, :datetime
|
72
|
-
# end
|
73
|
-
#
|
74
|
-
# self.down
|
75
|
-
# drop_table :users
|
76
|
-
# end
|
77
|
-
# end
|
78
|
-
class ModelGenerator < Genosaurus
|
79
|
-
|
80
|
-
require_param :name
|
81
|
-
|
82
|
-
# def generate
|
83
|
-
# directory(File.join(MACK_APP, "models"))
|
84
|
-
#
|
85
|
-
# template(File.join(File.dirname(__FILE__), "templates", "app", "models", "#{app_config.orm}.rb.template"), File.join(MACK_APP, "models", "#{param(:name).singular.underscore}.rb"), :force => param(:force))
|
86
|
-
# MigrationGenerator.new(@env.merge({"name" => "create_#{param(:name).plural}"})).generate
|
87
|
-
# end
|
88
|
-
|
89
|
-
def after_generate
|
90
|
-
MigrationGenerator.run(@options.merge({"name" => "create_#{param(:name).plural}"}))
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
<% if app_config.orm -%>
|
2
|
-
controller_template:
|
3
|
-
type: file
|
4
|
-
template_path: <%= File.join(templates_directory_path, "generic", "app", "controllers", "controller.rb.template") %>
|
5
|
-
output_path: <%= File.join("app", "controllers", "#{@name_plural}_controller.rb") %>
|
6
|
-
edit_template:
|
7
|
-
type: file
|
8
|
-
template_path: <%= File.join(templates_directory_path, "generic", "app", "views", "edit.html.erb.template") %>
|
9
|
-
output_path: <%= File.join("app", "views", @name_plural, "edit.html.erb") %>
|
10
|
-
index_template:
|
11
|
-
type: file
|
12
|
-
template_path: <%= File.join(templates_directory_path, "generic", "app", "views", "index.html.erb.template") %>
|
13
|
-
output_path: <%= File.join("app", "views", @name_plural, "index.html.erb") %>
|
14
|
-
new_template:
|
15
|
-
type: file
|
16
|
-
template_path: <%= File.join(templates_directory_path, "generic", "app", "views", "new.html.erb.template") %>
|
17
|
-
output_path: <%= File.join("app", "views", @name_plural, "new.html.erb") %>
|
18
|
-
show_template:
|
19
|
-
type: file
|
20
|
-
template_path: <%= File.join(templates_directory_path, "generic", "app", "views", "show.html.erb.template") %>
|
21
|
-
output_path: <%= File.join("app", "views", @name_plural, "show.html.erb") %>
|
22
|
-
<% else -%>
|
23
|
-
controller_template:
|
24
|
-
type: file
|
25
|
-
template_path: <%= File.join(templates_directory_path, "no_orm", "controller.rb.template") %>
|
26
|
-
output_path: <%= File.join("app", "controllers", "#{@name_plural}_controller.rb") %>
|
27
|
-
<% end -%>
|
28
|
-
functional_teat_template:
|
29
|
-
type: file
|
30
|
-
template_path: <%= File.join(templates_directory_path, "test.rb.template") %>
|
31
|
-
output_path: <%= File.join("test", "functional", "#{@name_plural}_controller_test.rb") %>
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# Generates scaffold for Mack applications.
|
2
|
-
#
|
3
|
-
# Example:
|
4
|
-
# rake generate:scaffold name=post
|
5
|
-
class ScaffoldGenerator < Genosaurus
|
6
|
-
|
7
|
-
require_param :name
|
8
|
-
|
9
|
-
def setup
|
10
|
-
@name_singular = param(:name).singular.underscore
|
11
|
-
@name_plural = param(:name).plural.underscore
|
12
|
-
@name_singular_camel = @name_singular.camelcase
|
13
|
-
@name_plural_camel = @name_plural.camelcase
|
14
|
-
end
|
15
|
-
|
16
|
-
def after_generate
|
17
|
-
if app_config.orm
|
18
|
-
ModelGenerator.run(@options)
|
19
|
-
end
|
20
|
-
update_routes_file
|
21
|
-
end
|
22
|
-
|
23
|
-
def update_routes_file
|
24
|
-
# update routes.rb
|
25
|
-
routes = File.join(MACK_CONFIG, "routes.rb")
|
26
|
-
rf = File.open(routes).read
|
27
|
-
unless rf.match(".resource :#{@name_plural}")
|
28
|
-
puts "Updating routes.rb"
|
29
|
-
nrf = ""
|
30
|
-
rf.each do |line|
|
31
|
-
if line.match("Mack::Routes.build")
|
32
|
-
x = line.match(/\|(.+)\|/).captures
|
33
|
-
line << "\n #{x}.resource :#{@name_plural} # Added by rake generate:scaffold name=#{param(:name)}\n"
|
34
|
-
end
|
35
|
-
nrf << line
|
36
|
-
end
|
37
|
-
File.open(routes, "w") do |f|
|
38
|
-
f.puts nrf
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
data/lib/generators/scaffold_generator/templates/generic/app/controllers/controller.rb.template
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
class <%= @name_plural_camel %>Controller < Mack::Controller::Base
|
2
|
-
|
3
|
-
# GET /<%= @name_plural %>
|
4
|
-
def index
|
5
|
-
@<%= @name_plural %> = <%= @name_singular_camel %>.find(:all)
|
6
|
-
end
|
7
|
-
|
8
|
-
# GET /<%= @name_plural %>/1
|
9
|
-
def show
|
10
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.find(params(:id))
|
11
|
-
end
|
12
|
-
|
13
|
-
# GET /<%= @name_plural %>/new
|
14
|
-
def new
|
15
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.new
|
16
|
-
end
|
17
|
-
|
18
|
-
# GET /<%= @name_plural %>/1/edit
|
19
|
-
def edit
|
20
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.find(params(:id))
|
21
|
-
end
|
22
|
-
|
23
|
-
# POST /<%= @name_plural %>
|
24
|
-
def create
|
25
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.new(params(:<%= @name_singular %>))
|
26
|
-
if @<%= @name_singular %>.save
|
27
|
-
redirect_to(<%= @name_plural %>_show_url(:id => @<%= @name_singular %>.id))
|
28
|
-
else
|
29
|
-
render(:action => "new")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# PUT /<%= @name_plural %>/1
|
34
|
-
def update
|
35
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.find(params(:id))
|
36
|
-
if @<%= @name_singular %>.update_attributes(params(:<%= @name_singular %>))
|
37
|
-
redirect_to(<%= @name_plural %>_show_url(:id => @<%= @name_singular %>.id))
|
38
|
-
else
|
39
|
-
render(:action => "edit")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# DELETE /<%= @name_plural %>/1
|
44
|
-
def delete
|
45
|
-
@<%= @name_singular %> = <%= @name_singular_camel %>.find(params(:id))
|
46
|
-
@<%= @name_singular %>.destroy<%= app_config.orm == "data_mapper" ? "!" : "" %>
|
47
|
-
redirect_to(<%= @name_plural %>_index_url)
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<h1>Edit <%= @name_singular_camel %></h1>
|
2
|
-
|
3
|
-
<%%= error_messages_for :<%= @name_singular %> %>
|
4
|
-
|
5
|
-
<form action="<%%= <%= @name_singular %>s_update_url(:id => @<%= @name_singular %>.id) %>" class="edit_<%= @name_singular %>" id="edit_<%= @name_singular %>" method="<%= @name_singular %>">
|
6
|
-
<input type="hidden" name="_method" value="put">
|
7
|
-
<% for column in columns -%>
|
8
|
-
<% unless column.column_name == "created_at" || column.column_name == "updated_at" -%>
|
9
|
-
<p>
|
10
|
-
<b><%= column.column_name.singular.camelcase %></b><br />
|
11
|
-
<%= column.form_field %>
|
12
|
-
</p>
|
13
|
-
<% end -%>
|
14
|
-
<% end -%>
|
15
|
-
<p>
|
16
|
-
<input id="<%= @name_singular %>_submit" name="commit" type="submit" value="Create" />
|
17
|
-
</p>
|
18
|
-
</form>
|
19
|
-
|
20
|
-
<%%= link_to("Back", <%= @name_singular %>s_index_url) %>
|
@@ -1,41 +0,0 @@
|
|
1
|
-
<h1>Listing <%= @name_plural_camel %></h1>
|
2
|
-
|
3
|
-
<table>
|
4
|
-
<tr>
|
5
|
-
<%
|
6
|
-
unless columns.empty?
|
7
|
-
columns.each do |col|
|
8
|
-
-%>
|
9
|
-
<th><%= col.column_name.camelcase %></th>
|
10
|
-
<%
|
11
|
-
end
|
12
|
-
else
|
13
|
-
-%>
|
14
|
-
<th> </th>
|
15
|
-
<%
|
16
|
-
end
|
17
|
-
-%>
|
18
|
-
</tr>
|
19
|
-
|
20
|
-
<%% for <%= @name_singular %> in @<%= @name_plural %> %>
|
21
|
-
<tr>
|
22
|
-
<%
|
23
|
-
unless columns.empty?
|
24
|
-
columns.each do |col| -%>
|
25
|
-
<td><%%= <%= @name_singular %>.<%= col.column_name %> %></td>
|
26
|
-
<%
|
27
|
-
end
|
28
|
-
else
|
29
|
-
-%>
|
30
|
-
<td> </td>
|
31
|
-
<% end -%>
|
32
|
-
<td><%%= link_to("Show", <%= @name_plural %>_show_url(:id => <%= @name_singular %>.id)) %></td>
|
33
|
-
<td><%%= link_to("Edit", <%= @name_plural %>_edit_url(:id => <%= @name_singular %>.id)) %></td>
|
34
|
-
<td><%%= link_to("Delete", <%= @name_plural %>_delete_url(:id => <%= @name_singular %>.id), :method => :delete, :confirm => "Are you sure?") %></td>
|
35
|
-
</tr>
|
36
|
-
<%% end %>
|
37
|
-
</table>
|
38
|
-
|
39
|
-
<br />
|
40
|
-
|
41
|
-
<%%= link_to("New <%= @name_singular_camel %>", <%= @name_plural %>_new_url) %>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<h1>New <%= @name_singular_camel %></h1>
|
2
|
-
|
3
|
-
<%%= error_messages_for :<%= @name_singular %> %>
|
4
|
-
|
5
|
-
<form action="<%%= <%= @name_singular %>s_create_url %>" class="new_<%= @name_singular %>" id="new_<%= @name_singular %>" method="<%= @name_singular %>">
|
6
|
-
<% for column in columns -%>
|
7
|
-
<% unless column.column_name == "created_at" || column.column_name == "updated_at" -%>
|
8
|
-
<p>
|
9
|
-
<b><%= column.column_name.singular.camelcase %></b><br />
|
10
|
-
<%= column.form_field %>
|
11
|
-
</p>
|
12
|
-
<% end -%>
|
13
|
-
<% end -%>
|
14
|
-
<p>
|
15
|
-
<input id="<%= @name_singular %>_submit" name="commit" type="submit" value="Create" />
|
16
|
-
</p>
|
17
|
-
</form>
|
18
|
-
|
19
|
-
<%%= link_to("Back", <%= @name_singular %>s_index_url) %>
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<p>
|
2
|
-
<h1><%= @name_singular_camel %></h1>
|
3
|
-
</p>
|
4
|
-
<% for column in columns -%>
|
5
|
-
<p>
|
6
|
-
<b><%= column.column_name.singular.camelcase %></b><br />
|
7
|
-
<%%= @<%= @name_singular %>.<%= column.column_name %> %>
|
8
|
-
</p>
|
9
|
-
<% end -%>
|
10
|
-
|
11
|
-
<%%= link_to("Edit", <%= @name_plural %>_edit_url(:id => @<%= @name_singular %>.id)) %> |
|
12
|
-
<%%= link_to("Back", <%= @name_plural %>_index_url) %>
|
@@ -1,38 +0,0 @@
|
|
1
|
-
class <%= @name_plural_camel %>Controller < Mack::Controller::Base
|
2
|
-
|
3
|
-
# GET /<%= @name_plural %>
|
4
|
-
def index
|
5
|
-
"<%= @name_plural_camel %>#index"
|
6
|
-
end
|
7
|
-
|
8
|
-
# POST /<%= @name_plural %>
|
9
|
-
def create
|
10
|
-
"<%= @name_plural_camel %>#create"
|
11
|
-
end
|
12
|
-
|
13
|
-
# GET /<%= @name_plural %>/new
|
14
|
-
def new
|
15
|
-
"<%= @name_plural_camel %>#new"
|
16
|
-
end
|
17
|
-
|
18
|
-
# GET /<%= @name_plural %>/1
|
19
|
-
def show
|
20
|
-
"<%= @name_plural_camel %>#show id: #{params(:id)}"
|
21
|
-
end
|
22
|
-
|
23
|
-
# GET /<%= @name_plural %>/1/edit
|
24
|
-
def edit
|
25
|
-
"<%= @name_plural_camel %>#edit id: #{params(:id)}"
|
26
|
-
end
|
27
|
-
|
28
|
-
# PUT /<%= @name_plural %>/1
|
29
|
-
def update
|
30
|
-
"<%= @name_plural_camel %>#update id: #{params(:id)}"
|
31
|
-
end
|
32
|
-
|
33
|
-
# DELETE /<%= @name_plural %>/1
|
34
|
-
def delete
|
35
|
-
"<%= @name_plural_camel %>#delete"
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
if using_active_record?
|
2
|
-
class ActiveRecord::Base # :nodoc:
|
3
|
-
def business_display_name
|
4
|
-
self.class.name#.titlecase
|
5
|
-
end
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
if using_data_mapper?
|
10
|
-
class DataMapper::Base # :nodoc:
|
11
|
-
def business_display_name
|
12
|
-
self.class.name#.titlecase
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
module Mack
|
18
|
-
module ViewHelpers
|
19
|
-
module OrmHelpers
|
20
|
-
DEFAULT_PARTIAL = %{
|
21
|
-
<div>
|
22
|
-
<div class="errorExplanation" id="errorExplanation">
|
23
|
-
<h2>Oi, there were errors! Fix `em!</h2>
|
24
|
-
<ul>
|
25
|
-
<% for error in errors %>
|
26
|
-
<li><%= error %></li>
|
27
|
-
<% end %>
|
28
|
-
</ul>
|
29
|
-
</div>
|
30
|
-
</div>
|
31
|
-
}
|
32
|
-
|
33
|
-
def error_messages_for(object_names = [], view_partial = nil)
|
34
|
-
object_names = [object_names]
|
35
|
-
object_names.flatten!
|
36
|
-
app_errors = []
|
37
|
-
object_names.each do |name|
|
38
|
-
object = instance_variable_get("@#{name}")
|
39
|
-
if object
|
40
|
-
object.errors.each do |key, value|
|
41
|
-
key = key.to_s
|
42
|
-
if value.is_a?(Array)
|
43
|
-
value.each do |v|
|
44
|
-
if v.match(/^\^/)
|
45
|
-
app_errors << v[1..v.length]
|
46
|
-
else
|
47
|
-
if key.class == String and key == "base"
|
48
|
-
app_errors << "#{v}"
|
49
|
-
else
|
50
|
-
app_errors << "#{object.business_display_name} #{key.underscore.split('_').join(' ')} #{v}"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
else
|
55
|
-
if value.match(/^\^/)
|
56
|
-
app_errors << value[1..value.length]
|
57
|
-
else
|
58
|
-
if key.class == String and key == "base"
|
59
|
-
app_errors << "#{value}"
|
60
|
-
else
|
61
|
-
app_errors << "#{object.business_display_name} #{key.underscore.split('_').join(' ')} #{value}"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
File.join(MACK_VIEWS, "application", "_error_messages.html.erb")
|
69
|
-
unless app_errors.empty?
|
70
|
-
if view_partial.nil?
|
71
|
-
if File.exist?(File.join(MACK_VIEWS, "application", "_error_messages.html.erb"))
|
72
|
-
render :partial => "application/error_messages", :locals => {:errors => app_errors}
|
73
|
-
else
|
74
|
-
render :text => DEFAULT_PARTIAL, :locals => {:errors => app_errors}
|
75
|
-
end
|
76
|
-
else
|
77
|
-
render :partial => view_partial, :locals => {:errors => app_errors}
|
78
|
-
end
|
79
|
-
else
|
80
|
-
""
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# self.include_safely_into(Mack::ViewBinder)
|
85
|
-
end # OrmHelpers
|
86
|
-
end # ViewHelpers
|
87
|
-
end # Mack
|