Displaying 20 results from an estimated 20000 matches similar to: "Looking for a way to avoid DoubleRenderError."
2006 Apr 08
2
respond_to causes DoubleRenderError?
I have a custom authentication plugin that redirects users to a login
site if they aren''t already authenticated and their session hasn''t
timed out. I had things working fine with straight http requests, but
wanted to add support for ajax requests. I thought this would be a
simple matter of replacing all of my "redirect_to <blah> and return
false" calls with
2006 Sep 22
6
Using after_filter to control rendering on actions
I have a common failure page that I may need to render to upon failing
some test that occurs in an after_filter method.
I''d like to use the after_filter to take over the control of the
rendering, like so:
def test_for_validity
some_boolean = my_test
return render(:action => ''disqualified'') unless some_boolean
@success_controller ||= controller_name
2007 Nov 30
5
render_to_string in an after filter
I''m using render_to_string in an after_filter, which renders a partial
that is sent to a web service. Here''s the code:
class MyController < ApplicationController
after_filter :post_to_webservice
def show
# show logic
end
def post_to_webservice
stuff = render_to_string :partial => ''stuff''
webservice_post(stuff)
end
I get a DoubleRenderError in the
2006 Feb 13
1
Change redirect after method ''redirect_to''
I want to be able to change the redirection url after I called
redirect_to, is that possible?
My specific use case is that I want to change the default redirection of
"Login Engine" method signup, but I am seeing no other way then
copy/past and change the parameters of redirect_to.
This questions extends to render method as well, I want is to avoid
DoubleRenderError exception.
--
2005 Jul 06
6
DoubleRenderError exception
The DoubleRenderError exception recently introduced is forcing me to go back and rewrite my apps authentication handler. Before I could do a redirect right in the middle of a request. Whatever was happening after that went unnoticed, I assumed it was simply ending the request after the redirect was called, but apparently it was going on and rendering the page.
Why can''t a redirect
2006 Dec 30
1
redirect_to(:action => ''foo'') and return
I''m not sure why this is happening, but if I do this in a controller
unless @variation && @variation.quantity > 0
flash[:error] = "Sorry, that product is currently not available."
redirect_to(:action => ''error'') and return
end
rspec tells me
2)
ActionController::DoubleRenderError in ''The Carts controller with an
2010 May 24
3
ActionController::DoubleRenderError
def dispfriends
@myfriend=[]
@myfriendlogin = []
i=0
@currentgroup = Group.find_by_id(params[:groupid])
puts @currentgroup.id
@currentfriends=
GroupFriend.find_all_by_user_id_and_group_id(current_user.id,
@currentgroup.id)
for n in @currentfriends
@myfriend=n.friend_id
@myusers = User.find_by_id(@myfriend)
@myfriendlogin[i]=@myusers.login
puts @myfriendlogin[i]
i=i+1
respond_to do
2006 Mar 13
1
issue with redirect_to
Hi all:
I can''t make redirect_to to unlock the current iframe using {:TARGET =>
"_top"}. It always stays in the current frame. I checked the
redirect_to code, it seems the method does not use "target". here is the
source code of redirect_to from ActionController::Base
def redirect_to(options = {}, *parameters_for_method_reference) #:doc:
753: case options
2010 Mar 21
3
Error in the code Doube Render (colins')
Hi everyone, i followed colins example and it worked perfectly but now i
get this error
ActionController::DoubleRenderError in UserController#login
Render and/or redirect were called multiple times in this action. Please
note that you may only call render OR redirect, and at most once per
action. Also note that neither redirect nor render terminate execution
of the action, so if you want to
2006 Feb 20
3
Background work
Greetings,
I''ve got a rails app which is basically an admin interface to a xml
dataset. Currently I''ve got rails rigged to call a function to spit the
entire dataset to file with every change. This would actually be ok, its
fairly infrequently updated, but when the dataset grows large the user sits
there waiting for it to dump with no feedback as to whats going on. Oh yes,
2010 Feb 08
3
Double render/redirect philosophy
Ok, I think I understand why RoR will flag an attempt double render in
an action.
What I don''t understand is the philosophy of render and redirect_to.
Specifically, why isn''t a return implicit in both those methods?
Or, I guess, more to the point ... what are the advantages of writing
code in the action after a render/redirect_to?
--
Posted via http://www.ruby-forum.com/.
--
2006 May 11
1
rendering in after_filter
Hi!
Is it possible to render the action within the after_filter method, or
is the rendering performed before?
I have something like this:
class FooController
after_filter :send
def a
@content=...
end
def b
@content=..
end
protected
def send
send_data(@content,...)
end
end
However, when calling the action a or b, the @content doesn''t get sent,
but instead
I found a way to dynamically switch languages in your rails app -- look at it and give your opinions
2006 Jan 05
0
I found a way to dynamically switch languages in your rails app -- look at it and give your opinions
step 1) Do what is there in the manual Using Gettext To Translate Your Rails
Application as it is.
Step2)Now create a table in your project database to store your language
names which you are supporting in the project for example "langs"
step 3)populate your table with language names, namely hindi, japanes etc.
step 4) create a scffold for with aLang controller, just so that life is
2006 Jan 05
0
I found a way to dynamically switch languages in your railsapp -- look at it and give your opinions
can you share the code so that others can benefit out of it???
silvy mathews
________________________________
From: rails-bounces@lists.rubyonrails.org
[mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of sekhar
Sent: Thursday, January 05, 2006 7:14 AM
To: rails@lists.rubyonrails.org
Subject: [Rails] I found a way to dynamically switch languages in your
railsapp -- look at it and give
2006 May 25
5
Is there a way to abstract the updating of other parts of the page after an Ajax request without putting using the standard view file?
Hey all,
I''d like to abstract the process of updating different portions of the
page after an Ajax request has taken place. Rather than simply putting
the extra view logic in the standard rjs template, it seems to give
better separation if there is a split between the core view logic (ie,
inserting a row in a table), and updating any associated portions of
the page.
Is this possible? I
2009 Mar 15
0
rspec-rails 1.2.0 Released
rspec-rails version 1.2.0 has been released!
* <http://rspec.info/>
* <http://wiki.github.com/dchelimsky/rspec>
* <http://wiki.github.com/dchelimsky/rspec/rails>
* <http://wiki.github.com/dchelimsky/rspec/upgrades>
Behaviour Driven Development for Ruby on Rails.
Changes:
### Version 1.2.0
IMPORTANT INFORMATION: Due to changes in Rails-2.3, there are some changes
in
2006 Jan 19
1
partials and instance variables for file_column
Hi,
Sebastian Kanthak of the file_column-Plugin wrote once:
"is the photo object inside a local variable or an instance variable
(e.g. photo or @photo)? url_for_file_column only works with instance
variables, like all other active record form helpers. Could this be
the problem?"
So I''m using file_column in a partial, e.g.
<%= render (:partial => "product",
2007 Feb 28
1
One page in app keeps rendering as text/plain
Here''s what I get from wget -S:
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Wed, 28 Feb 2007 15:52:06 GMT
Server: Apache/1.3.37 (Unix) mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a
mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.4
FrontPage/5.0.2.2635.SR1.2 mod_ssl/2
.8.28 OpenSSL/0.9.7a
#<#<Class: 0x2a96d0b978>:0x2a96d0b928>Content-Type:
2009 Jul 14
1
How to add after_filter-style render
Hello
I would like to execute specific action rendering something into page
after each of my ajax calls. In example I would like to update some
div or display an alert.
How I imagine it could work is as follows
class ApplicationController < ActionController::Base
after_filter :do_something_after_each_ajax_call
def do_something_after_each_ajax_call
if request.xml_http_request?
2006 Jul 07
4
need help with some ugly code - is there a better way?
Hi,
In my user_controller.rb, I have the following method, which is supposed
to send the user to their profile, dependng on what "role" they are (the
roles correspond to the other controllers: venue, band, fan):
def login
if request.post?
if session[:user_id] = User.authenticate(params[:user][:login],
params[:user][:password])
flash[:message] =