search for: sitecontroller

Displaying 9 results from an estimated 9 matches for "sitecontroller".

2006 Mar 08
7
Function could determine the caller action ?
Is it possible to determine which action call the function ? In example, func_test in ApplicationController could determine which action from SiteController is calling her ? in class ApplicationController I have def func_test if ( calling from index ) return "1" end if ( calling from contact ) return "2" end end and in class SiteController def index @var = func_test end def contact @var = func_test...
2006 Mar 07
2
Determine which action, which controller is calling ?
...h :action , wich :controller is calling the function func_test in ApplicationController ? in class ApplicationController I have def func_test if ( calling from index ) return "1" end if ( calling from contact ) return "2" end end and in class SiteController def index @var = func_test end def contact @var = func_test end Thanks
2007 Oct 25
3
Setting session values
Okay, I give up. I have been trying to set session values in a controller, but no matter what, once the request is made and inside the controller, the session is empty. What''s the correct way? I have tried session[''whatever''] = something controller.stub!(:session).and_return(session) I tried creating a new session, but nothing seems to do it. I''m sure
2005 Mar 24
3
Caching computation in rails?
Caching computation in rails? Simple example: factorial modulus a large number input: integer x output: factorial( x ) % 12345678901234567 I want it so that if it computes factorial of N once, it will not have to compute for N again. code: class SiteController < ApplicationController caches_action :factorial, :inv def examine @inv = @params[''inv''] @outv = factorial @inv.to_i end def factorial( inv ) y=1 while (inv > 0) do y*=inv inv-=1 end (y % 12345678901234567) end end I am ru...
2007 Jul 30
6
Object.stubs doesn''t seem to work.
Hi I''m using Mocha 0.5.3 and I want to stub out a call to Time.now, just like the example in the post http://blog.floehopper.org/articles/2007/06/08/mocha-0-5-released However, trying it in irb gets me the following error: >> require ''mocha'' => true >> Time.stubs(:now).returns(Time.parse(''Thu Feb 01 00:00:00 UTC 2007'')) NoMethodError:
2006 Feb 08
6
can''t get date_select to work
...page renders the dates are showing correctly according to how the controller set them up, so date_select is showing the right fields from my model. I''ve tried different browsers, and I''ve tried gem rails and edge rails. From the console log I can see the values: Processing SiteController#booking (for 127.0.0.1 at 2006-02-08 10:19:25) [POST] Parameters: {"commit"=>"Check Availability", "action"=>"booking", "id"=>"1", "controller"=>"site", "booking"=>{"startd...
2010 Oct 20
1
Routing errors with Rails 3.0.1 and Rspec 2.0.1
...m to track it down. A few commits back, my app was fully passing my spec suite. It was on Rails 3.0.0 and Rspec 2.0.0.beta.20. I''ve now upgraded to rails 3.0.1 and rspec 2.0.1 Now, I''m getting tons, and I mean tons of failures that say things like, to take a simple case: 113) SiteController GET ''about'' should be successful Failure/Error: get ''about'' No route matches {:action=>"about", :controller=>"site"} # ./spec/controllers/site_controller_spec.rb:21 Here''s the spec: describe "GET '...
2007 May 01
2
Silence logging for a particular action
Anyone know how to silence logging of a particular Rails action? I have monit setup to ping a "/ping" route and the action just renders some quick text. The problem is I get: Processing SiteController#ping (for 127.0.0.1 at 2007-04-30 19:55:46) [GET] Session ID: 78f1e1aa5c7ddb194565ee79950de618 Parameters: {"action"=>"ping", "controller"=>"site"} Completed in 0.00019 (5159 reqs/sec) | Rendering: 0.00006 (28%) | DB: 0.00000 (0%) | 200 OK [http://...
2007 Mar 01
0
FastCGI and Apache. Anybody know what can cause this error?
...I''ve heard that apache and fastcgi is not the best solution, do you think this is fcgi''s fault? Could it be a bug in my ruby code? Could it be a bug in my version of rails? Restarting my site via: touch dispatch.fcgi seemed to do the trick Here''s the error: Processing SiteController#show_page (for 74.94.128.241 at 2007-03-01 13:58:26) [POST] Parameters: {"action"=>"show_page", "url"=>["portfolio", "design", "print", "fibonaccis-spirals-in-nature"], "controller"=>"site"} Actio...