Archive

Posts Tagged ‘rails 2.3’

Passing parameters to a partial

August 19, 2009 2 comments

Hi,

This is just a quick post about how to pass parameters to rails partials. (As most of you all know, partials are lightweight than components) and personally I’m using it in my project as headers and footers.

But if we are to pass some parameters to the partial how to do that ?? its simple as this

render :partial => “<partial name>”, :locals => { :param1 => “value”}

<partial name> – name of your partial (Ex /partials/footer)

:params1 – parameter name

“value” – value

Its quick and simple 🙂


Advertisements
Categories: Ruby Rails Tags: , ,

render_component plugin and rails 2.3

August 7, 2009 5 comments

OK, since Rails 2.3 has depriciated the render_component method and advising to use a plugin for that I went and downloaded the plugin from

http://github.com/rails/render_component/tree/master but ended up being getting this error..

/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/aliasing.rb:33:in `alias_method’: undefined method `set_session_options’ for class `ActionController::Base’ (NameError)

🙂

Ok… Now what… After doing some googling finally I found a fix to that…. Use this git

script/plugin install 
git://github.com/lackac/render_component.git -r rails-edge 

and that fixed my issue... hope yours as well :)

and thanks for this link —

http://www.42.mach7x.com/2009/06/24/undefined-method-render_component-with-activescaffold-and-rails-2-3-2/