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 S.
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 S. [email protected] 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 O.
http://techno-weenie.net
“Rick O.” [email protected] writes:
On 3/8/06, Surendra S. [email protected] 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 S.
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
`----