Are there some exceptions to this command? I was having problems with
an ajax form still rendering the layout, then copy-pasted this code from
an ebook to test it and it gives a "template is missing" error as
though
it''s still trying to render.
def reverse
@reversed_text = params[:text_to_reverse].reverse
render :layout => false
end
<%= form_remote_tag :update => "reversed",
:url => { :action => ''reverse'' }
%>
<p>Text to reverse: <%= text_field_tag
''text_to_reverse'' %></p>
<p id="reversed"></p>
<p><%= submit_tag ''Reverse!'' %></p>
<%= end_form_tag %>
Suggestions?
--
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?hl=en
-~----------~----~----~----~------~----~------~--~---
> > Suggestions?maybe a render :inline => @reversed_text, :layout => false -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
that works, thanks -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
try this:
render :text => @reversed_text, :layout => false
or with rjs
render :update do |page|
page.replace_html "reversed", @reversed_text
end
the layout is more a thing "around" a template you render; views/
layouts/application.rhtml for example is the best place to put in your
html <head/> tag
for the topic checkout the api-manual
http://api.rubyonrails.org/classes/ActionController/Base.html#M000267
or the best book about it :-)
http://www.pragmaticprogrammer.com/titles/rails/index.html
On 15 Mai, 21:34, Aaron Wally
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Are there some exceptions to this command? I was having problems with
> an ajax form still rendering the layout, then copy-pasted this code from
> an ebook to test it and it gives a "template is missing" error as
though
> it''s still trying to render.
>
> def reverse
> @reversed_text = params[:text_to_reverse].reverse
> render :layout => false
> end
>
> <%= form_remote_tag :update => "reversed",
> :url => { :action =>
''reverse'' } %>
> <p>Text to reverse: <%= text_field_tag
''text_to_reverse'' %></p>
> <p id="reversed"></p>
> <p><%= submit_tag ''Reverse!'' %></p>
> <%= end_form_tag %>
>
> Suggestions?
>
> --
> Posted viahttp://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?hl=en
-~----------~----~----~----~------~----~------~--~---