-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
57 lines (36 loc) · 1.37 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
merb_autoscaffold
=================
Merb AutoScaffold is a Merb plugin that provides scaffolding for free
for all models. Merb AutoScaffold currently works with DataMapper 0.3
and ActiveRecord.
==== Usage:
You must first build and install the gem. From the merb_autoscaffold directory, run:
$ sudo rake gem install
Then add a dependency in your init.rb file:
dependency 'merb_autoscaffold'
Scaffolds will then be available for all models in your application. If a controller
for a model already exists, then any actions in that controller will be preserved,
while the missing CRUD actions will be added
==== Example:
# /app/models/blog.rb
class Blog < DataMapper::Base
property :title, :string
property :content, :text
has_many :comments
end
# /config/init.rb
...
dependency 'merb_autoscaffold'
...
# Run the Merb server
$ merb
# Scaffolds are now available at http://localhost:4000/scaffolds from your web browser
# You can customize the path to the scaffolds by editing the AutoScaffold's configs
# in the /config/init.rb file in the +after_app_loads+ block:
Merb::BootLoader.after_app_loads do
# scaffolds will be available at /foo instead of /scaffolds
Merb::Plugins.config[:merb_autoscaffold][:namespace] = 'foo'
end
==== Caveats
Currently, autoscaffolds only work with DataMapper 0.3 and ActiveRecord models.
Autoscaffolds also will not work with flat Merb apps.