Extending ActionController
1 comment Latest by inung Tue, 08 May 2007 05:56:27 GMT
In my pursuit yesterday to make add the desired functionality to ActionController (render string to string), I talked to bitsweat about this and he suggested that I just extend the class in my rails app.
So, I created a file in lib, called action_controller_ext.rb (a shim as he referred to it) and put this in the file:
require 'action_controller'
class ActionController::Base
def render_string_to_string(text = nil, type = "rhtml") #:doc:
add_variables_to_assigns
@template.render_template(type, text)
end
end
require 'action_controller'to
require 'action_controller_ext'
Now, I can move my clients app around dev/test/live servers and not need to modify the actual Rails source code. (still would be nice if it did that though)
Enjoying the content? Be sure to subscribe to my RSS feed.






cooooll….:D