Few examples being, Restricting Views Based on Roles, Search forms in views.
Of course these days with ruby gems like Declarative Authorization , Authlogic, and Searchlogic life is not the same.
Still, as things get complex more, it gets really difficult to create user interfaces to powerfully play with models while following the programming style that rails encourages.
Okay now coming to the point of my rant.
So here's the problem, there are two models with habtm relationship (dont ask why), now we know the traditional form with either
- checkboxes or
- collection_select in the form ,
- also I came across another solution which was just as I wanted with option transfer select boxes called SwapSelect.
ok now I wanted the following
- A select box on the left with filters to list by name keywords, display only 25 records and then display additional by pagination etc.
- A second select box on the right which displays existing options and acts like a container for adding new options from the one on the left.
- and buttons in between to add selected to right, add selected to left, add all to right and add all to left options.
What happens after the options are final is that I clone the final select box and give it a new name with _ids in the end folowing rails convention to make a habtm form object which I attach it to the model's form. and the voila the record updated with a put or created with a post following REST.
The way rails architecture allows you to design this kind of complex simply is what inspired "Me" to write about it.
Soon as I published I saw another article which is very good, and its a plugin too.