The calendar is gone.
Click here to view posts


Page render rjs
I recently posted about using RJS partials. I could of found out how to do this by searching the google. I found a nice site that sums up a peep code screencast.

I still think that this is an ugly way of doing this. It also has an extra debug statement that makes it look messy. So like my rjs extension example I created a partial render method. Odd little side note: I can not name my method render. I am looking in to why.
module ActionView
  module Helpers
    module PrototypeHelper
      class JavaScriptGenerator #:nodoc:
        module GeneratorMethods
          def partial(*args)
            reset_rjs_debug = ActionView::Base.debug_rjs
            ActionView::Base.debug_rjs = false
            @lines << "#{render(*args)}"
            ActionView::Base.debug_rjs = reset_rjs_debug
          end
        end
      end
    end
  end
end

Now your rjs script looks like
page.partial(:partial=>"moo",{:local=>"var"})

I do not like how the arguments repeat the partial. It would make more sense if I could call my method render (page.render). I also could do more with the arguments.
partial(name,*args)
...
@lines << "#{render(:partial=>name,*args)}"
I did not test this but it should work. Maybe there is a problem if no *args are passed in.

Rails rendering
No doubt any one looking at rails for speed will find that rendering sucks up a fair bit of time. I have two ideas to change the rendering system. The first is to remove the benchmarking code for production. I have no proof that this will make things faster. I am just sick of seeing it in my profiling log. The second idea I have is allowing the user of rails to change out rendering engines. For example using markaby instead of ERB or libxml(c lib) instead of XMLbuilder. I think using different libs could yield a faster render. If not with a c lib replacement then with another lib yet to be written.