This is not equivalent.
First, update_attributes will attempt to save the record, but it
wasn’t time to save it yet in my action.
I can't let the model handle the conversion because I'm converting a
Grails application to Rails in parts, so the views are actually
implemented in Grails at this moment and the parameters are being
rules for casting to boolean. I need to be sure that only ‘true’
should be handled as a true value for this request.
I'm using a proxy for redirecting the new implementation to the
Rails application. I’ve been willing to convert this application to
Rails for a long time, but I never had the chance. But last week I
found a critical bug in Grails and I couldn’t find any workaround to
So, I decided to take this path for fixing the application. First I
needed to make sure I was able to handle authentication and
authorization the same way.
For that I implemented an action in the Grails application that
would return me the id of the logged in user. Then all I had to do
user_id = open(user_id_url, 'Cookie' =>
I created a new Devise authentication strategy and this part was
completed so that I could focus in the fix for the buggy Grails
Also I had to change the Devise session routes to match those of the
And finally, since the cookies are specific to the context path, I
needed my Rails application to be mounted in the same context path.
So I tried the instructions in the Configuring Rails guide, but it
didn’t work for me:
And I had to make some more changes to Devise routes as well as
putting all my routes inside the context path namespace.
So now I'm able to convert the Grails application to Rails in small
steps and that is great!
Actually my current authentication setup is a bit different and I
handle the rememberMe cookie directly. Since I use the Shiro library
to decrypt the cookie and I didn’t want to implement everything in
Ruby nor use JRuby on Rails as it is a slow platform for
development, I implemented the authentication service using JRuby
and Drb and created another strategy using the Drb client for
handling the rememberMe cookie without requiring the Grails
application to be alive for remembered sessions.
Well, anyway I'll try to write an elaborate article on the details
of this setup for anyone else willing to take the same approach as
me for converting an application to Rails.
But in those cases, the Rails API doesn't help much on dealing with
such special cases where the Rails conventions are not always
Currently I don't override any property, but I wouldn't like to have
to remember that I’m bypassing any overrides if I decide to do so in
I mean, if there is an override, there is a reason for it to
exist… They shouldn’t be just bypassed.