similar to: return custom http responses from a controller?

Displaying 20 results from an estimated 60000 matches similar to: "return custom http responses from a controller?"

2001 Sep 14
2
"return" function
I tried to write a function like this f1 <- function(){ if (condition 1) return if (condition 2) return ... if (condition 3) return do more work } Where I am using return to exit the function prematurely when I detect conditions that warrant it. Return doesn't seem to work this way. How should I do this? Chris Marshall
2010 Jan 31
3
Append/Prepend to a template from controller method
I want a method in app/controllers/application.rb that can prepend/append text to whatever template gets rendered. Of course I can''t call render twice w/o getting a double render error, so is this possible? I want to redirect after a delay using a meta refresh. Here''s what I''ve got: app/controllers/application_controller.rb: def redirect_after_delay (url, delay)
2007 Oct 26
1
Custom method in Application Controller
Hi All, I took this idea Christian Hellsten and Jarkko Laine''s "Beginning Ruby on Rails E-Commerce". Here is the situation. I will be using the "options_from_collection_for_select" and "collection_select" form helper methods in my view to render drop-down selection lists for City and State that have corresponding city_id and state_id foreign key references
2007 Jan 03
2
Using helpers...
All, I am getting an undefined method exception while trying to use a helper method in a xerb file. I am running version 0.0.8 module Merb module FredHelper def blee( args ) .... end end end In the xerb template I have xml.bobo blee( args ) At runtime I am getting undefined method ''blee'' I tryied
2007 Feb 17
5
render collection with index
Is there any method for getting the current iteration (for changing row colors) in the category partial? <%=render(:partial => "category", :collection => @categories)%> thanks, andy -- Andrew Stone --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post
2006 Mar 29
4
trouble adding to database (stringify_keys)
I''m brand new to rails and am trying to build a simple ajax email collection form. It''s just a coming soon sort of thing where the user can enter his email address in the field, hit submit, and the ajax form dumps the email into the database and says "success" unless the email is blank or not unique in which case it says "failure." The trouble is, no
2006 Apr 24
12
pass checked boxes to controller
Noobie question here. :) I have a form with check boxes on them. I simply want the user to check the appropriate boxes, click the action (Add Visits). It''s my understanding, that these check box values go into a hash (add_visit_for_this_Pt), but I can''t seem to get this hash back to my controller for processing. Below is my form. Basically, all the controller is
2010 Mar 20
1
1.6.1.18 -> 1.6.2.6 T38 Fax: call drops
Using spandsp-0.0.6-pre17, SendFax on 1.6.1.18 and ReceiveFax on 1.6.2.8. Sip.conf on both sides has t38pt_udptl = yes. -- Executing [s at fax-tx-test:3] SendFAX("SIP/side-sip-00000009", "/var/spool/asterisk/fax/20091113_1455.tif") in new stack [Mar 20 17:05:34] WARNING[6433]: app_fax.c:178 phase_e_handler: Error transmitting fax. result=49: The call dropped
2007 Sep 18
2
Move to .oga prematurely?
Hi list, I have been trying to get the new file extension for Ogg FLAC (.oga) to work with Amarok. But it does not look to be possible due to limitations in the xine and gstreamer engines. Maybe the move to .oga was prematurely? I have done some testing with other players?including Banshee, Quod Libet, and others?but have not had any success with playing the .oga files. Only player I have
2009 Jul 16
2
[LLVMdev] [patch] CodeEmitter Memory Foot Reduction
On Jul 16, 2009, at 10:04 AM, Aaron Gray wrote: > > I understand that you say that, but I can't bring myself to care at > this point. Have you thought about how many cycles are already used > to produce the instructions that lead to the emission of those 10K > bytes? The total percentage of time spent doing these virtual calls > will be tiny compared to the total
2008 Jan 17
6
how to control self.method access
i think self.method just like class method,so if i want to define it as a private method,i should use private_class_method :my_method but i found follow code in < <Agile Web Development with Rails>> private def self.hash_password(password) Digest::SHA1.hexdigest(password) end just a mistake or there have some thing which i cannot get?
2007 Dec 05
4
render :update and controller private methods
Probably asked and answered, but... Why are controller private methods inaccessible inside the block passed to render :update ? This does not work: class MyController < ApplicationController def some_action render :update do |page| page.replace_html ''an_element'', some_private_method end end private def some_private_method return
2008 Nov 17
2
Can't seem to test http error codes
in application.rb rescue_from ActiveRecord::RecordNotFound { |e| http_status_code (:missing, e) } def http_status_code(status, exception) @exception = exception respond_to do |format| format.html { render :template => "shared/status_# {status.to_s}", :status => status } format.any { head status } end end in a controller project =
2007 Sep 12
10
Need help refactoring a controller, perhaps add threading?
Good morning, I''ve been working on my first Rails app. I''m replacing an old Perl script that scrapes a bunch of data from an Oracle database, generates a bunch of charts then builds a static webpage with the charts. I''ve re-built it in Rails, with about 25% of the code it took to do in Perl and the users can now get dynamic charts instead of day old charts (or
2008 Jun 13
3
Alternative to storing ActiveRecord object in session
I''m writing a wizard-like module in my application where, in a series of steps, the user builds upon an ActiveRecord object, and in the end, saves the AR object into the database. The ActiveRecord object is fairly complex, with a has_many association that could potentially get large, so I don''t want to store it directly in the session. In fact, having done so already caused a
2007 Jun 17
2
SIP Peering--call terminated prematurely
I am attempting to establish SIP peering between Asterisk and an AltiGen soft PBX. This is my first experience with SIP peering. I can successfully make both inbound and outbound calls to/from a softphone on the AltiGen system (network access is provided by a PRI on the Asterisk system), but they are disconnected unexpectedly. The attachment is a redirect of the Asterisk CLI during a call that
2008 Jan 23
2
Combine custom validations with helpers
Hi I have a model that uses several validation helpers, for example validates_presence_of. Now I want to add a custom validate method for a very complex validation. I override validate in the model and it works by itself but when I do this the helper validations stop working. I guess the helper methods rely on the ActiveRecord::Base#validate original method in some way. Has anyone any suggestions
2009 Dec 04
1
[LLVMdev] LLVM's GC support
Hi Paul, On 2009-12-04, at 09:34, Paul Melis wrote: > I hope you don't mind me sending this mail directly to you (instead of to llvm-dev), but you seem to be the expert on LLVM's GC support :) If you'd rather have me send to llvm-dev, please say so. You'll reach a wider audience with the list, though I haven't been able to keep up with it lately. > I'm trying to
2007 Jan 04
5
Help accessing http headers?
Hi, I''m using Mechanize, and I''ve developed a lot of code around it. I''d like to be able to check the Etag header during a get to see if the page has changed, as well as some other http header information. Can I do that without hacking Mechanize myself? Does anyone have any examples of how to do this? William
2007 Jun 03
5
can I use template to assemble a html page in an controller and redirect to another controller?
Hi,all! I want to assemble a html page and put it into flash and redirect to another controller ,for example: flash[:aaa]="<html><body><div>hi</div></body></html>" but what I need is to assemble some more complicate html page,so I want to read the render result of a template before to send it to browser. Any thought? Thanks in advance :-)