similar to: Double render/redirect philosophy

Displaying 20 results from an estimated 40000 matches similar to: "Double render/redirect philosophy"

2009 Dec 25
18
rescue_from ActionController::RoutingError II
OK ... so I''m not supposed to use it but ... Why doesn''t rescue_from ActionController::RoutingError work witht he code from http://www.rubyplus.org/episodes/20-Extended-RESTful-Authentication-Rails-2-App.html class ApplicationController < ActionController::Base helper :all # include all helpers, all the time # See ActionController::RequestForgeryProtection for details
2009 Dec 23
8
Where did this value in a form come from?
Newb here. I have a form and a value that is being displayed ... and I have no idea where the value came from. I have done a <%= debugger; '''' %> in the form and, indeed, the debugger stops at the statement. I have tried to trace through the code to see where the value came from ... and I gave up. So ... what in Rails initializes the fields of a form? -- Posted via
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 Jan 10
7
Can only render or redirect once per action - why?
I ran into this error message a quite a few times since my app requires branching to different pages from the same action... say using a switch statement. Ofcourse I found that you can use multiple redirects or renders if you do render :action => ''new'' and return false I hate to code something I don''t understand fully. Any explanation of this will be greatly
2008 Dec 03
2
Render and/or redirect were called multiple times in this action
I''m trying to add an application enabled/disabled flag in my application.. This is my code. [code=] # application.rb ... before_filter :check_enabled_flag private def check_enabled_flag application_flag = ApplicationFlag.find(:first) if application_flag.application_enabled redirect_to application_disabled_path and return end end[/code] and for some reason
2010 Mar 23
7
redirection in format.json ...
I have presently a render :json which modify the current page if @request.save format.html { redirect_to(@request) } format.json { render :json => { :result => ''success'', :request => request_path(@request) } } .... but I would like rather to redirect to an index page I wrote this but it doesn''t redirect ... format.json {
2006 Mar 22
7
What is difference between render & redirect methods?
Hi, Thest are two methods:- 1) redirect_to :action => ''list'' 2) render :action => ''list'' what is difference between these two methods?????? Thanks. Prash -- Posted via http://www.ruby-forum.com/.
2006 Mar 20
4
Ajax.Request w/standard redirect doesn''t render
I am doing an Ajax call in my page to a controller method like so: new Ajax.Request(''<%= url_for(:action => "target_list_add" )%>'', { asynchronous:true });" In my controller method "target_list_add", I do something and then I say: redirect_to( :action => ''target_list_upload'', :layout => false ) I know for certain
2010 Jun 08
8
rails, ajax, json, and script
Could someone please demonstrate the code to send both json (or xml) AND javascript (to be executed) in a single Ajax request? Is this even possible? -- 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
2011 Jun 01
2
calling render with query string
Hi all, In one of my create action in the controller, I am catching a error and trying to show errors on the same page. It was all good when I called render action => ''new''. However, I also wanted to append a query string for consistence purposes. How do I do that with render? For now, I can only call redirect_to and put the error in the flash variable which
2010 May 03
7
rendering images dynamically
Hi, I have a rails application where I respond to a request by fetching image urls from various web api calls and need to display them as they come available. I am able to display all the images once I get them all, but that causes an unacceptable delay for my user. One approach I am trying is, from my controller, set an @image variable, and then pass in a block to the model that retrieves the
2011 Jan 11
9
Can I omit respond_with.
If I don''t want xml results but only html can I omit respond_with in some actions? For example index from: respond_with(@sectors = Sector.all) becomes only @sectors = Sector.all isn''t it? -- 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
2012 Feb 01
6
Does Devise make use of a "status" method? Weird bug.
So I''ve inherited a legacy application and I''m trying to work around the edges as I put an admin tool interface on top of the existing code base. I install Devise for user authentication, since I''ve used it in the past. I change none of the default code. And yet, on successful sign in, I get an error: Render and/or redirect were called multiple times in this action.
2013 Mar 07
3
Expected response to be a <:redirect>, but was <200>
Hey i am new to testing on rails and i have the following test written describe ''GET search'' do it ''finds a named account directly'' do get :search, name: ''test'' expect(response).to redirect_to(account_path(''test'')) end I have been getting the following error SystemAccountsController GET search finds a
2010 Jul 01
6
Close Modalpopup with RJS
hi guys: I''m scratching my head on this one: I have a twitter app where I''m trying to open a modalpopup with a twitter sign in, get them to sign in, then close the popup and refresh the main window. My code however refreshes the main window with the popup window result, which I thought was really strange: application.html.erb function OpenModalPopUP() {
2010 Sep 17
25
Trying to look up comment through an ID, but failing
I am trying to allow users to reply through comments by allowing users to click a reply link next to the parent comment. It will send in a parameter to the ''new'' comment view, like so: | <%= link_to "Reply", new_comment_path(:in_reply_to => comment.id) %> The form will use the :in_reply_to parameter in order to save that id as the parent id, like so:
2010 Jan 22
5
Rails Render Issue
Hi, I am adding login functionality to my app which has two controllers users and photos and i am having some trouble. In my users/index view <%if logged_in? %> <%=render "photos/index"%> <%else%> .... Home page With login..... <%end%> In my photos/index view <%if logged_in? %> .... Welcome page ..... <%else%>
2013 Oct 18
3
before_action - performing an action to prevent
class WebsocketController < WebsocketRails::BaseController private def authenticate? unless current_user.token == message[:token] current_redirect_to ''home/index'' false # that here we need to do to stop the further execution? end end end class WorldsController < WebsocketController before_action :authenticate? def index
2009 Nov 18
4
rails newbie : routing error
After much ado about the naming of model adn controllers... model : Expense controller : Expenses route : map.resources :expenses Here I am using mysql database and created a unique index, since db:migrated created an id object and made it as primary key. Now in the def create @expense = Expense.new(params[:expense]) if @expense.save flash[:viola] = ''New expense saved.. be
2012 Jan 18
3
Cannot redirect to nil!
I need some help please.. when I created web application about books market, i create a cart and using test the message error appear like this on rake test:functionals LineItemsControllerTest > test_should_create_line_item > ERROR > Cannot redirect to nil! and also appear on web side, thats error told that "Cannot redirect to nil!" Then i was checking the code,