Railsify your Grails params map January 22, 2007
In Rails parameters passed to a controller are usually multi-dimentional maps.
foo[bar] and foo[zed] would be mapped to params[’foo’][’bar’] and params[’foo’][’zed’] (in ruby),
which happens to be the same way you’d access them in Groovy. Unfortunately Grails
only has built in support for that lame old fashioned one dimentional parameter map.
Needing to submit a form with 2 different objects in it I figured it would be much easier to
manage with a Rails style params map. So, I wipped up this little abstract class for my
Grails controllers to extend, with a method to Railsify the params map, either in place or in a new map.
Before you ask why I’m using Grails instead of “the real thing” it’s because I work for an “All Java Shop”
which, like most companies, isn’t so sure about this “Ruby thing” yet.
Leave a Reply