how about a helper?
app/views/shared/_foobar.rhtml
----------------------
Hello <%= text %> from foobar
application_helper.rb
------------------------------
def foo (text)
render :partial => "/shared/foobar", :locals => {:text =>
text}
end
myapp.rhtml (using foo)
---------------------------------
<%= foo "hello" %>
Note that the partial expects ''text'', not
''@text'' sent via locals
On Aug 1, 3:09 pm, skibud2
<mike.hallo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I am not sure if I am the only one, but I really like the idea of
> render_component. Too bad it is depricated now. Currently I am using
> components so that I can have custom view functions with their own
> rhtml files in one folder. That way, I can and drop that folder into
> any of my projects and I have that component instantly available. Is
> there a better way of doing this?
>
> For example,
> =====================================================> foobar.rhtml
> ----------------------
> Hello <%= @text %> from foobar
>
> foo.rb
> -------------------------
> class FooController < ActionController::Base
> def foo
> @text = params[:text]
> render :partial => "foobar"
> end
> end
>
> def foo (text)
> render_component :controller => "foo", :action =>
"foo", :params
> => {:text => text}
> end
>
> myapp.rhtml (using foo)
> ---------------------------------
> <%= foo "hello" %>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---