Hi,
I just can''t seem to get my RJS template to work.
I have this in my .rhtml file:
<%= link_to_remote( "1", {:url => { :controller =>
"log", :action =>
"rate", :id => post.id, :rating => 1}}, :class =>
''one-star'', :name =>
''Rate this post 1 star out of 3'') %>
My rate.rjs has this (for testing purposes):
page.alert(''RJS works!'')
That doesn''t that a thing.
So I added this to my .rhtml file:
<%= link_to_remote( "3", {:url => { :controller =>
"log", :action =>
"rate", :id => post.id, :rating => 3},
:complete=>''alert(request.responseText)''}, :class =>
''three-stars'',
:name => ''Rate this post 3 star out of 3'') %>
Now I get a popup saying:
alert(''RJS Works!'') instead of actually doing the alert.
any ideas?
MJ
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
On 10/24/06, MJ <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I just can''t seem to get my RJS template to work. > I have this in my .rhtml file:Rename it .rjs. -- Greg Donald http://destiney.com/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> > Now I get a popup saying: > alert(''RJS Works!'') instead of actually doing the alert.What does Firebug show for the request / response? Usually that will clue you in on the problem. Michael --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
MJ wrote:> Hi, > > I just can''t seem to get my RJS template to work. > I have this in my .rhtml file: > <%= link_to_remote( "1", {:url => { :controller => "log", :action => > "rate", :id => post.id, :rating => 1}}, :class => ''one-star'', :name => > ''Rate this post 1 star out of 3'') %> > > My rate.rjs has this (for testing purposes): > page.alert(''RJS works!'') > > That doesn''t that a thing. > So I added this to my .rhtml file: > <%= link_to_remote( "3", {:url => { :controller => "log", :action => > "rate", :id => post.id, :rating => 3}, > :complete=>''alert(request.responseText)''}, :class => ''three-stars'', > :name => ''Rate this post 3 star out of 3'') %> > > Now I get a popup saying: > alert(''RJS Works!'') instead of actually doing the alert. > > any ideas? > > MJ > > -- > Posted via http://www.ruby-forum.com/.Are you including a tag like this in your layout? <%= javascript_include_tag :defaults %> _Kevin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Michael Trier wrote:>> >> Now I get a popup saying: >> alert(''RJS Works!'') instead of actually doing the alert. > > What does Firebug show for the request / response? Usually that will > clue you in on the problem. >It says alert("RJS works!"); in the response But the alert doesn''t show up in the browser.> Michael-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
_Kevin wrote:> MJ wrote: >> >> any ideas? >> >> MJ >> >> -- >> Posted via http://www.ruby-forum.com/. > > Are you including a tag like this in your layout? > > <%= javascript_include_tag :defaults %>Yep!> > _Kevin-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Greg Donald wrote:> On 10/24/06, MJ <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> I just can''t seem to get my RJS template to work. >> I have this in my .rhtml file: > > Rename it .rjs.I don''t quite understand I have an idex.rhtml, with the link to the rate controller via a link_to_remote and a rate.rjs file. This is correct, no?> > > -- > Greg Donald > http://destiney.com/-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> I don''t quite understand I have an idex.rhtml, with the link > to the rate controller via a link_to_remote and a rate.rjs file. > This is correct, no?Yes. Try this in your controller instead, and let us know: def rate render :update do |page| page.alert("RJS WORKS") end end --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Michael Trier wrote:> > I don''t quite understand I have an idex.rhtml, with the link > > to the rate controller via a link_to_remote and a rate.rjs file. > > This is correct, no? > > Yes. Try this in your controller instead, and let us know: > > def rate > render :update do |page| > page.alert("RJS WORKS") > end > endI prefer this style myself. RJS templates are more about logic and functionality, so it makes sense to put them in the controller. The one exception for me would be a template that I might use in several different controllers. _Kevin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Michael Trier wrote:>> I don''t quite understand I have an idex.rhtml, with the link >> to the rate controller via a link_to_remote and a rate.rjs file. >> This is correct, no? > > Yes. Try this in your controller instead, and let us know: > > def rate > render :update do |page| > page.alert("RJS WORKS") > end > endI tried it, but still no popup. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Maybe an idea about my setup will help: I am using Apache 2.2 and Mongrel and reverse_proxy_fix. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> Maybe an idea about my setup will help: > I am using Apache 2.2 and Mongrel and reverse_proxy_fix.Would you email me the necessary files: controller, views, helpers. I''ll take a look. Michael --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Michael Trier wrote:>> Maybe an idea about my setup will help: >> I am using Apache 2.2 and Mongrel and reverse_proxy_fix. > > Would you email me the necessary files: controller, views, helpers. > I''ll take a look. > > MichaelNo need :-) I just figured it out. I had old Javascript files,I did an update an now everything works great! MJ -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 10/26/06, MJ <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Michael Trier wrote: > >> Maybe an idea about my setup will help: > >> I am using Apache 2.2 and Mongrel and reverse_proxy_fix. > > > > Would you email me the necessary files: controller, views, helpers. > > I''ll take a look. > > > > Michael > > No need :-) I just figured it out. I had old Javascript files,I did an > update an now everything works great!Great. Michael --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Not entirely sure what I need to change here to make this work:
I have a form in a partial _new.rhtml
In the form (right below) I call to the canskill partial which shows the
current entries:
<table id"canskills">
<tr><th>Skill</th><th>Skill
level</th><th>Skill experience</th><th>Sill last
used</th></tr>
<%= render :partial => ''canskills/canskill'', :collection
=> @
candidate.canskills %>
</table>
<p><strong>Enter skill information</strong></p>
<div id="new-canskill">
<% remote_form_for :canskill, :url => canskill_url, :candidate_id =>
@candidate_id, :html => { :id => ''canskill-form'' } do
|form| %>
<table border="1">
<tr>
........................... # all the form elements ..............
<%= submit_tag "add skill" %>
<% end %>
new.rjs looks like this:
page.insert_html :bottom, ''canskills'', :partial =>
''canskill''
page.form.reset ''canskill-form''
One of the problems is as a new form it loads up the form and then calls on
create to input the data -
def new
@canskill = Canskill.new
@candidate_id = params[:candidate_id]
render :partial => ''new''
def create
@canskill = Canskill.new(params[:canskill])
@candidate_id = params[:candidate_id]
end
The problem is it continues to look for a create.rhtml but doesn''t
update
the canskill partial ?
Stuart
--
http://en.wikipedia.org/wiki/Dark_ambient
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---