Scaffolding Extensions Now Supports Ramaze

9 views
Skip to first unread message

jeremy...@gmail.com

unread,
Feb 11, 2008, 7:51:13 PM2/11/08
to Ramaze
I've released the latest version of my Scaffolding Extensions plugin,
which is the first version with support for Ramaze. Thanks to
Jonathan Buch for his help in understanding some of Ramaze's internals
and making this release possible.

Scaffolding Extensions provides a powerful and simple to use
administrative interface to perform common actions on models. It has
the following features:

* Creates pages for browsing, creating, deleting, displaying,
updating, searching, and merging records
* Choose which fields are displayed in the scaffolds and in which
order
* Handles associated records for common one-to-many, many-to-one, and
many-to-many associations.
* Extensive support for modifying the display and working of the
plugin
* Advanced features such as access control, autocompleting, and eager
loading

Scaffolding Extensions is not a code generator, and isn't really
scaffolding at all, as you are not expected to modify the output.
Instead, you use configuration options inside the model to control the
display of the pages. The scaffolding analogy is misleading,
Scaffolding Extensions is not really scaffolding--it is a completely
functional structure that you can easily modify to better suit your
needs.

I recommend adding Scaffolding Extensions to the root of the Ramaze
application, though any subdirectory should work.

Assuming you are using the recommended defaults (e.g. models are
located in model/*.rb), add the following to your runner (e.g.
start.rb):

$:.unshift('scaffolding_extensions/lib')
require 'scaffolding_extensions'

If your models are located somewhere else, it is easiest to let
Scaffolding Extensions know about them manually (this is only
necessary if you are using scaffold_all_models without :only):

ScaffoldingExtensions.all_models = [Model1, Model2, Model3]

You should add this code after your models have been loaded but before
your controllers have been loaded.

Then, inside a controller:

scaffold_all_models

Go to the root of the controller for links to pages to manage each of
the models.

Currently, Scaffolding Extensions only supports the ActiveRecord ORM.
There is a clearly defined interface for the plugin to interact with
the ORM (see doc/model_spec.txt), so if you want to add support for
other ORMs (e.g. Sequel or Datamapper), please let me know and maybe
we can work on it together.

Feel free to contact me at co...@jeremyevans.net if you have any
questions about Scaffolding Extensions.

You can get Scaffolding Extensions via subversion or as a tarball:

* svn: svn://code.jeremyevans.net/rails-plugins/scaffolding_extensions
* file: http://code.jeremyevans.net/code/scaffolding_extensions.tar.gz
* RDoc: http://code.jeremyevans.net/doc/scaffolding_extensions

Thanks,
Jeremy

Aman Gupta

unread,
Feb 11, 2008, 7:56:12 PM2/11/08
to Ramaze
This sounds cool, do you have a demo online anywhere?

Aman Gupta
> Feel free to contact me at c...@jeremyevans.net if you have any

jeremy...@gmail.com

unread,
Feb 11, 2008, 11:53:34 PM2/11/08
to Ramaze
On Feb 11, 4:56 pm, Aman Gupta <themastermi...@gmail.com> wrote:
> This sounds cool, do you have a demo online anywhere?

http://spam.jeremyevans.net/

This isn't a demo of the plugin per se, it's a demo of an accounting
system that uses the plugin. The "Manage {Accounts,Entities,Entries}"
links near the bottom of navigation pane are the parts added by the
plugin. This is actually a fairly light use of the plugin, but it
makes use of autocompleting and access control (though the demo is
limited to a single account, so you can't see that).

Here's the scaffolding code:

ActiveRecord::Base::SCAFFOLD_OPTIONS[:text_to_string] = true
ActiveRecord::Base::SCAFFOLD_OPTIONS[:association_list_class] =
'scaffold_associations_tree'
ActiveRecord::Base::SCAFFOLD_OPTIONS[:auto_complete].merge!
({:sql_name=>'name', :search_operator=>'ILIKE', :results_limit=>15, :phrase_modifier=>:to_s})

class Account < ActiveRecord::Base
@scaffold_select_order = 'accounts.name'
@scaffold_fields = [:name, :account_type, :hidden, :description]
@scaffold_column_types = {:description=>:text}
@scaffold_column_options_hash =
{:description=>{:cols=>'50', :rows=>'4'}}
@scaffold_associations =
[:recent_credit_entries, :recent_debit_entries]
@scaffold_session_value = :user_id
end

class Entity < ActiveRecord::Base
@scaffold_fields = [:name]
@scaffold_select_order = 'name'
@scaffold_associations = [:recent_entries]
@scaffold_auto_complete_options = {}
@scaffold_session_value = :user_id

def scaffold_name
name[0..30]
end
end

class Entry < ActiveRecord::Base
@scaffold_fields =
[:date, :reference, :entity, :credit_account, :debit_account, :amount, :memo, :cleared]
@scaffold_select_order = 'entries.date DESC, entities.name,
accounts.name, debit_accounts_entries.name, entries.amount'
@scaffold_include = [:entity, :credit_account, :debit_account]
@scaffold_auto_complete_options = {:sql_name=>"reference ||
date::TEXT || entities.name || accounts.name ||
debit_accounts_entries.name || entries.amount::TEXT"}
@scaffold_session_value = :user_id

def scaffold_name
"#{date.strftime('%Y-%m-%d')}-#{reference}-#{entity.name if
entity}-#{debit_account.name if debit_account}-#{credit_account.name
if credit_account}-#{money_amount}"
end
end

gabriele renzi

unread,
Feb 12, 2008, 2:26:32 AM2/12/08
to ram...@googlegroups.com
On Feb 12, 2008 1:51 AM, <jeremy...@gmail.com> wrote:
>
> I've released the latest version of my Scaffolding Extensions plugin,
> which is the first version with support for Ramaze. Thanks to
> Jonathan Buch for his help in understanding some of Ramaze's internals
> and making this release possible.

<snip>

I, for one, welcome our new automatic backend overlords :)
More seriously, thanks a lot for sharing this.

Reply all
Reply to author
Forward
0 new messages