Hi, everyone,
I''m trying to update the content of a div using link_to_remote and RJS
template.
Everything works fine if I use the default Prototype/Scriptaculous
libraries, but I want to use jRails ''coz other parts of my application
use a lot of jQuery.
Here are the steps I done:
1. inside StatesController.rb I defined the following action:
def update_view
# do nothing just render the default template, in my case a RJS
template
end
2. here''s the whole update_view.rjs file:
page.insert_html :bottom, ''result_view'', "Hello,
World!<br/>"
3. inside show.html.haml (I really don''t like erb):
= link_to_remote ''update view'', :url => { :action =>
:update_view }
#result_view
4. here is what I get in log/development.log when using Prototype/
Scriptaculous:
Parameters:
{"authenticity_token"=>"60e55877a4b807f568824ed36c5849e95dc07607",
"action"=>"update_view",
"controller"=>"states"}
5. here is what I get in log/development.log when using jRails
Parameters:
{"authenticity_token"=>"60e55877a4b807f568824ed36c5849e95dc07607",
"action"=>"show",
"id"=>"update_view",
"controller"=>"states",
"_"=>"1216305965026"}
The action called is "show" (the current one) instead
"update_view".
I know it must be a jRails issue, and should post in jRails list, but
I believe someone here could help me faster.
Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
On 17 Jul 2008, at 16:53, Samflores wrote:> > 4. here is what I get in log/development.log when using Prototype/ > Scriptaculous: > Parameters: > {"authenticity_token"=>"60e55877a4b807f568824ed36c5849e95dc07607", > "action"=>"update_view", "controller"=>"states"} > > 5. here is what I get in log/development.log when using jRails > Parameters: > {"authenticity_token"=>"60e55877a4b807f568824ed36c5849e95dc07607", > "action"=>"show", "id"=>"update_view", "controller"=>"states", > "_"=>"1216305965026"} > > The action called is "show" (the current one) instead "update_view". > > I know it must be a jRails issue, and should post in jRails list, but > I believe someone here could help me faster.Going up a level, what url are the two things hitting? Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The URL that contains the link_to_remote is http://localhost/states/1
(showing a state)
The generated html for link_to_remote is:
1. for default rails librarires:
<a href="#" onclick="new
Ajax.Request(''/states/update_view'',
{asynchronous:true, evalScripts:true,
parameters:''authenticity_token=''
+
encodeURIComponent(''0b492fd8ce19923563c844fe68d869c45b475b6d'')});
return false;">update</a>
2. for jRails:
<a href="#"
onclick="$.ajax({data:''authenticity_token='' +
encodeURIComponent(''0b492fd8ce19923563c844fe68d869c45b475b6d''),
dataType:''script'',
url:''/states/update_view''}); return
false;">update</
a>
both are pointing to same URL: /states/update_view
On 17 jul, 13:03, Frederick Cheung
<frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> On 17 Jul 2008, at 16:53, Samflores wrote:
>
> > 4. here is what I get in log/development.log when using Prototype/
> > Scriptaculous:
> > Parameters:
> >
{"authenticity_token"=>"60e55877a4b807f568824ed36c5849e95dc07607",
> > "action"=>"update_view",
"controller"=>"states"}
>
> > 5. here is what I get in log/development.log when using jRails
> > Parameters:
> >
{"authenticity_token"=>"60e55877a4b807f568824ed36c5849e95dc07607",
> > "action"=>"show",
"id"=>"update_view",
"controller"=>"states",
> > "_"=>"1216305965026"}
>
> > The action called is "show" (the current one) instead
"update_view".
>
> > I know it must be a jRails issue, and should post in jRails list, but
> > I believe someone here could help me faster.
>
> Going up a level, what url are the two things hitting?
>
> Fred
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---