Ruby on Rails SubList Plugin 0.1 review
DownloadRuby on Rails SubList Plugin makes it easy to have dynamic lists of related models on a single editing page. The plugin is design
|
|
Ruby on Rails SubList Plugin makes it easy to have dynamic lists of related models on a single editing page.
The plugin is designed for models with one or more has_many relationship with other models.
By using AJAX for adding and removing "sub-forms" one can present the user with a single edit page that creates/edits the parent model as well as all of the children.
Usage:
Place the sub_list directory in the vendor/plugins dir of your application.
In the controller which you wish to have a sub list displayed, add the following lines:
include UIEnhancements::SubList
helper :SubList
sub_list 'SubModel', 'parent' do |new_research_student|
#Place any construction (ie. defaults) required here
end
Replace 'SubModel' with the class name of the sub model you wish to make available.
Replace 'parent' with the parent object.
For instance, if you wish to have a Person controller that has a sub list of Dogs for each person, the sub model would be 'Dog' and the parent would be 'person'. It is expected that @person would exist and that it contains a has_many relationship named 'dogs'.
Ruby on Rails SubList Plugin 0.1 search tags