trust 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -1
- data/lib/trust.rb +13 -2
- data/lib/trust/version.rb +1 -1
- data/test/dummy/app/controllers/clients_controller.rb +0 -13
- data/test/dummy/app/controllers/mongo_accounts_controller.rb +100 -0
- data/test/dummy/app/controllers/mongo_clients_controller.rb +94 -0
- data/test/dummy/app/models/mongo_account.rb +42 -0
- data/test/dummy/app/models/mongo_client.rb +41 -0
- data/test/dummy/app/models/permissions.rb +17 -0
- data/test/dummy/app/views/mongo_accounts/_form.html.erb +46 -0
- data/test/dummy/app/views/mongo_accounts/edit.html.erb +31 -0
- data/test/dummy/app/views/mongo_accounts/index.html.erb +48 -0
- data/test/dummy/app/views/mongo_accounts/new.html.erb +30 -0
- data/test/dummy/app/views/mongo_accounts/show.html.erb +35 -0
- data/test/dummy/app/views/mongo_clients/_form.html.erb +46 -0
- data/test/dummy/app/views/mongo_clients/edit.html.erb +31 -0
- data/test/dummy/app/views/mongo_clients/index.html.erb +48 -0
- data/test/dummy/app/views/mongo_clients/new.html.erb +30 -0
- data/test/dummy/app/views/mongo_clients/show.html.erb +35 -0
- data/test/dummy/config/mongoid.yml +20 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/log/test.log +799 -0
- data/test/dummy/test/functional/mongo_accounts_controller_test.rb +123 -0
- data/test/dummy/test/functional/mongo_clients_controller_test.rb +74 -0
- data/test/dummy/test/unit/permissions_test.rb +112 -0
- metadata +38 -4
data/README.md
CHANGED
@@ -17,6 +17,7 @@ Well, we used [DeclarativeAuthorization](http://github.com/stffn/declarative_aut
|
|
17
17
|
* Support for inheritance in the permissions model
|
18
18
|
* Natural code evaluation in the permission declarations, i.e. you understand completely what is going on, because the implementation is done the way you implement condifitions in rails for validations and alike.
|
19
19
|
* Automatic loading of instances and parents in controller
|
20
|
+
* Mongoid support
|
20
21
|
|
21
22
|
### What is not supported in Trust
|
22
23
|
|
@@ -24,7 +25,6 @@ Well, we used [DeclarativeAuthorization](http://github.com/stffn/declarative_aut
|
|
24
25
|
|
25
26
|
### Currently not supported, but may be in the future
|
26
27
|
|
27
|
-
* Support for devise. However you may easily implement this by overriding one method in your controller.
|
28
28
|
* cannot and cannot? expressions.
|
29
29
|
|
30
30
|
# Install and Setup
|
@@ -241,4 +241,11 @@ def set_user
|
|
241
241
|
end
|
242
242
|
```
|
243
243
|
|
244
|
+
## Devise integration
|
244
245
|
|
246
|
+
If you have your ```ApplicationController``` as the trustee you will need to reverse this in devise that inherits the ```ApplicationController```.
|
247
|
+
Add this to your devise initializer:
|
248
|
+
|
249
|
+
``` Ruby
|
250
|
+
DeviseController.trustee :off
|
251
|
+
```
|
data/lib/trust.rb
CHANGED
@@ -34,6 +34,17 @@ require 'trust/controller'
|
|
34
34
|
class ActionController::Base
|
35
35
|
include Trust::Controller
|
36
36
|
end
|
37
|
-
|
38
|
-
|
37
|
+
if defined?(ActiveRecord)
|
38
|
+
class ActiveRecord::Base
|
39
|
+
include Trust::ActiveRecord
|
40
|
+
end
|
41
|
+
end
|
42
|
+
# always, as it may not exists yet
|
43
|
+
module Mongoid
|
44
|
+
module Document
|
45
|
+
include Trust::ActiveRecord
|
46
|
+
def Document.included(base)
|
47
|
+
base.send(:extend,Trust::ActiveRecord::ClassMethods)
|
48
|
+
end
|
49
|
+
end
|
39
50
|
end
|
data/lib/trust/version.rb
CHANGED
@@ -37,8 +37,6 @@ class ClientsController < ApplicationController
|
|
37
37
|
# GET /clients/1
|
38
38
|
# GET /clients/1.json
|
39
39
|
def show
|
40
|
-
@client = Client.find(params[:id])
|
41
|
-
|
42
40
|
respond_to do |format|
|
43
41
|
format.html # show.html.erb
|
44
42
|
format.json { render json: @client }
|
@@ -48,24 +46,15 @@ class ClientsController < ApplicationController
|
|
48
46
|
# GET /clients/new
|
49
47
|
# GET /clients/new.json
|
50
48
|
def new
|
51
|
-
@client = Client.new
|
52
|
-
|
53
49
|
respond_to do |format|
|
54
50
|
format.html # new.html.erb
|
55
51
|
format.json { render json: @client }
|
56
52
|
end
|
57
53
|
end
|
58
54
|
|
59
|
-
# GET /clients/1/edit
|
60
|
-
def edit
|
61
|
-
@client = Client.find(params[:id])
|
62
|
-
end
|
63
|
-
|
64
55
|
# POST /clients
|
65
56
|
# POST /clients.json
|
66
57
|
def create
|
67
|
-
@client = Client.new(params[:client])
|
68
|
-
|
69
58
|
respond_to do |format|
|
70
59
|
if @client.save
|
71
60
|
format.html { redirect_to @client, notice: 'Client was successfully created.' }
|
@@ -80,8 +69,6 @@ class ClientsController < ApplicationController
|
|
80
69
|
# PUT /clients/1
|
81
70
|
# PUT /clients/1.json
|
82
71
|
def update
|
83
|
-
@client = Client.find(params[:id])
|
84
|
-
|
85
72
|
respond_to do |format|
|
86
73
|
if @client.update_attributes(params[:client])
|
87
74
|
format.html { redirect_to @client, notice: 'Client was successfully updated.' }
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
class MongoAccountsController < ApplicationController
|
26
|
+
|
27
|
+
belongs_to :mongo_client
|
28
|
+
|
29
|
+
# GET /clients/1/accounts
|
30
|
+
# GET /clients/1/accounts.json
|
31
|
+
def index
|
32
|
+
@mongo_accounts = resource.relation.all
|
33
|
+
|
34
|
+
respond_to do |format|
|
35
|
+
format.html # index.html.erb
|
36
|
+
format.json { render json: @mongo_accounts }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# GET /clients/1/accounts/1
|
41
|
+
# GET /clients/1/accounts/1.json
|
42
|
+
def show
|
43
|
+
respond_to do |format|
|
44
|
+
format.html # show.html.erb
|
45
|
+
format.json { render json: @mongo_account }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# GET /clients/1/accounts/new
|
50
|
+
# GET /clients/1/accounts/new.json
|
51
|
+
def new
|
52
|
+
respond_to do |format|
|
53
|
+
format.html # new.html.erb
|
54
|
+
format.json { render json: @mongo_account }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# GET /clients/1/accounts/1/edit
|
59
|
+
def edit
|
60
|
+
end
|
61
|
+
|
62
|
+
# POST /clients/1/accounts
|
63
|
+
# POST /clients/1/accounts.json
|
64
|
+
def create
|
65
|
+
respond_to do |format|
|
66
|
+
if @mongo_account.save
|
67
|
+
format.html { redirect_to mongo_client_mongo_account_path(@mongo_account.mongo_client,@mongo_account), notice: 'Account was successfully created.' }
|
68
|
+
format.json { render json: @mongo_account, status: :created, location: @mongo_account }
|
69
|
+
else
|
70
|
+
format.html { render action: "new" }
|
71
|
+
format.json { render json: @mongo_account.errors, status: :unprocessable_entity }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# PUT /clients/1/accounts/1
|
77
|
+
# PUT /clients/1/accounts/1.json
|
78
|
+
def update
|
79
|
+
respond_to do |format|
|
80
|
+
if @mongo_account.update_attributes(params[:mongo_account])
|
81
|
+
format.html { redirect_to mongo_client_mongo_account_path(@mongo_account), notice: 'Account was successfully updated.' }
|
82
|
+
format.json { head :no_content }
|
83
|
+
else
|
84
|
+
format.html { render action: "edit" }
|
85
|
+
format.json { render json: @mongo_account.errors, status: :unprocessable_entity }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# DELETE /clients/1/accounts/1
|
91
|
+
# DELETE /clients/1/accounts/1.json
|
92
|
+
def destroy
|
93
|
+
@mongo_account.destroy
|
94
|
+
|
95
|
+
respond_to do |format|
|
96
|
+
format.html { redirect_to mongo_client_mongo_accounts_url }
|
97
|
+
format.json { head :no_content }
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
class MongoClientsController < ApplicationController
|
26
|
+
# GET /clients
|
27
|
+
# GET /clients.json
|
28
|
+
def index
|
29
|
+
@mongo_clients = MongoClient.all
|
30
|
+
|
31
|
+
respond_to do |format|
|
32
|
+
format.html # index.html.erb
|
33
|
+
format.json { render json: @mongo_clients }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# GET /clients/1
|
38
|
+
# GET /clients/1.json
|
39
|
+
def show
|
40
|
+
respond_to do |format|
|
41
|
+
format.html # show.html.erb
|
42
|
+
format.json { render json: @mongo_client }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# GET /clients/new
|
47
|
+
# GET /clients/new.json
|
48
|
+
def new
|
49
|
+
respond_to do |format|
|
50
|
+
format.html # new.html.erb
|
51
|
+
format.json { render json: @mongo_client }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# POST /clients
|
56
|
+
# POST /clients.json
|
57
|
+
def create
|
58
|
+
respond_to do |format|
|
59
|
+
if @mongo_client.save
|
60
|
+
format.html { redirect_to @mongo_client, notice: 'MongoClient was successfully created.' }
|
61
|
+
format.json { render json: @mongo_client, status: :created, location: @client }
|
62
|
+
else
|
63
|
+
format.html { render action: "new" }
|
64
|
+
format.json { render json: @mongo_client.errors, status: :unprocessable_entity }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# PUT /clients/1
|
70
|
+
# PUT /clients/1.json
|
71
|
+
def update
|
72
|
+
respond_to do |format|
|
73
|
+
if @mongo_client.update_attributes(params[:mongo_client])
|
74
|
+
format.html { redirect_to @mongo_client, notice: 'Client was successfully updated.' }
|
75
|
+
format.json { head :no_content }
|
76
|
+
else
|
77
|
+
format.html { render action: "edit" }
|
78
|
+
format.json { render json: @mongo_client.errors, status: :unprocessable_entity }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# DELETE /clients/1
|
84
|
+
# DELETE /clients/1.json
|
85
|
+
def destroy
|
86
|
+
@mongo_client = MongoClient.find(params[:id])
|
87
|
+
@mongo_client.destroy
|
88
|
+
|
89
|
+
respond_to do |format|
|
90
|
+
format.html { redirect_to mongo_clients_url }
|
91
|
+
format.json { head :no_content }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
class MongoAccount
|
26
|
+
include Mongoid::Document
|
27
|
+
|
28
|
+
belongs_to :mongo_client
|
29
|
+
field :name, type: String
|
30
|
+
field :client_id, type: Integer
|
31
|
+
field :created_by_id, type: Integer
|
32
|
+
|
33
|
+
before_create :set_owner
|
34
|
+
|
35
|
+
def set_owner
|
36
|
+
self.created_by_id = User.current.id
|
37
|
+
end
|
38
|
+
|
39
|
+
def created_by
|
40
|
+
User.find_by_id(self.created_by_id)
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
class MongoClient
|
26
|
+
include Mongoid::Document
|
27
|
+
|
28
|
+
has_many :mongo_accounts
|
29
|
+
field :name, type: String
|
30
|
+
field :accountant_id, type: Integer
|
31
|
+
|
32
|
+
before_create :set_accountant
|
33
|
+
|
34
|
+
def set_accountant
|
35
|
+
self.accountant_id = User.current.id
|
36
|
+
end
|
37
|
+
|
38
|
+
def accountant
|
39
|
+
User.find_by_id(self.accountant_id)
|
40
|
+
end
|
41
|
+
end
|
@@ -42,6 +42,9 @@ module Permissions
|
|
42
42
|
role :accountant, can(:manage)
|
43
43
|
role all, can(:read)
|
44
44
|
end
|
45
|
+
|
46
|
+
class MongoClient < Client
|
47
|
+
end
|
45
48
|
|
46
49
|
class Account < Default
|
47
50
|
role :accountant do
|
@@ -57,6 +60,20 @@ module Permissions
|
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
63
|
+
class MongoAccount < Default
|
64
|
+
role :accountant do
|
65
|
+
can :create, :if => :associated_with_client?
|
66
|
+
can :update, :if => :creator?
|
67
|
+
end
|
68
|
+
role :department_manager, :accountant do
|
69
|
+
can :create, :if => lambda { parent && parent.accountant == :superspecial }
|
70
|
+
end
|
71
|
+
|
72
|
+
def associated_with_client?
|
73
|
+
parent && parent.is_a?(::MongoClient) && parent.accountant == user.name
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
60
77
|
class Account::Credit < Account
|
61
78
|
role :guest do
|
62
79
|
can :create, :if => lambda { user.name == 'wife'}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<%
|
2
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
3
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
4
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
5
|
+
# Copyright (c) 2012 Patrick Hanevold
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
# a copy of this software and associated documentation files (the
|
9
|
+
# "Software"), to deal in the Software without restriction, including
|
10
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
13
|
+
# the following conditions:
|
14
|
+
#
|
15
|
+
# The above copyright notice and this permission notice shall be
|
16
|
+
# included in all copies or substantial portions of the Software.
|
17
|
+
#
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
23
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
+
%>
|
26
|
+
<%= form_for(@mongo_account, :url => mongo_client_mongo_accounts_path(@mongo_client)) do |f| %>
|
27
|
+
<% if @mongo_account.errors.any? %>
|
28
|
+
<div id="error_explanation">
|
29
|
+
<h2><%= pluralize(@mongo_account.errors.count, "error") %> prohibited this account from being saved:</h2>
|
30
|
+
|
31
|
+
<ul>
|
32
|
+
<% @mongo_account.errors.full_messages.each do |msg| %>
|
33
|
+
<li><%= msg %></li>
|
34
|
+
<% end %>
|
35
|
+
</ul>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<div class="field">
|
40
|
+
<%= f.label :name %><br />
|
41
|
+
<%= f.text_field :name %>
|
42
|
+
</div>
|
43
|
+
<div class="actions">
|
44
|
+
<%= f.submit %>
|
45
|
+
</div>
|
46
|
+
<% end %>
|