Hello,
I am using RJS and Edge Rails and I was wondering if the page object should
be available in helpers also.
For example if I have a helper function
def update_flash_messages
page.replace_html ''flash_messages'', (show_flash_messages
:textilize => true)
page.visual_effect ''flash_messages'', :appear
end
and then in my RJS files I call
update_flash_messages
But right now the above code _doesn''t work_, rather I have to pass the
page
object as shown below:
def update_flash_messages(page)
page.replace_html ''flash_messages'', (show_flash_messages
:textilize => true)
page.visual_effect ''flash_messages'', :appear
end
and RJS file
update_flash_messages page
Notice the passing of `page'' object. Will it not be convenient if Rails
does
it automatically.
Or am I missing something?
Thanks.
--
Surendra Singhi
http://ssinghi.kreeti.com, http://www.kreeti.com
,----
| Great wits are sure to madness near allied,
| And thin partitions do their bounds divide.
|
| (John Dryden, Absalom and Achitophel, 1681)
`----
On 3/8/06, Surendra Singhi <efuzzyone@netscape.net> wrote:> Hello, > I am using RJS and Edge Rails and I was wondering if the page object should > be available in helpers also.Sure can, on the latest code in trunk, but you have to call them on the page object: class RjsController def rjs render :update do |page| page.update_flash_messages end end end module RjsHelper def update_flash_messages page.replace_html ''flash_messages'', (show_flash_messages :textilize => true) page.visual_effect ''flash_messages'', :appear end end -- Rick Olson http://techno-weenie.net
"Rick Olson" <technoweenie@gmail.com> writes:> On 3/8/06, Surendra Singhi <efuzzyone@netscape.net> wrote: >> Hello, >> I am using RJS and Edge Rails and I was wondering if the page object should >> be available in helpers also. > > Sure can, on the latest code in trunk, but you have to call them on > the page object:Thanks Rick, I will upgrade to the latest code in trunk. -- Surendra Singhi http://ssinghi.kreeti.com, http://www.kreeti.com Read the latest news at: http://news.kreeti.com ,---- | "War is Peace! Freedom is Slavery! Ignorance is Strength!" | -- Orwell, 1984, 1948 `----