Displaying 20 results from an estimated 100000 matches similar to: "Calling controller methods from runner scripts?"
2006 Jan 27
0
Cache Sweepers and runner scripts that act on models?
I created a script that I call by ''./script/runner -e production
UpdateItems.get_new_items()'', which basically calls the model Item:
Item.create(attributes...)
I''ve set up a cache sweeper which removes caches after each
create/destroy/update on Item, and it works fine when accessing
controllers via the web server, but apparently doesn''t work via runner.
2007 Mar 26
2
Calling a controller action from script/console or runner
Is there a way to call or invoke a controller method from script/console
or script/runner? The reason is that I''d like to pre-cache some of the
actions on my controller.
The pseudo code below is what I''d like to be able to do:
class MyController < ApplicationController
caches_action :test
def test
puts ''Hi there''
end
end
script/console:
2007 Dec 12
3
undefined method: controller_name
With rspec 1.0.8 I have a spec in the directory:
spec/units/controllers/application_controller_spec.rb
require File.dirname(__FILE__) + ''/../../spec_helper''
class DummyController < ApplicationController
def index
raise "Prevent index from rendering"
end
end
describe ApplicationController, "Handling errors in production",
:behaviour_type =>
2005 Dec 28
4
undefined method `include''
I''m getting this error in Rails:
undefined method `include'' for
#<MenusController:0x408efd1c>
The offending code is:
require "rexml/document"
include REXML
I see there may be a problem with GCC 4 on OSX, but
I''m using Redhat with GCC 3.2.
http://weblog.rubyonrails.org/articles/2005/12/22/is-gcc-4-0-incompatible-with-ruby-on-os-x-and-elsewhere
2006 Sep 13
2
stale spec runner?
I''ve been working with the RSpec on Rails plugin. Great job guys!
The Rails spec runner (server) definitely speeds things up nicely.
But I''m having some trouble keeping it functional. When I start the
server, the first spec execution runs fine. Every following
execution fails though. Each spec complains about the
''controller_path'' missing from my
2008 Jul 11
0
Catch all errors in script/runner?
I have a rails app that is run exclusively as a script/runner process,
and I''d like to be able to catch all errors that occur in these
processes in a standardized way.
With a normal rails app, one can override rescue_action_in_public in
ApplicationController, but I''m only using models. Is there something
similar I can do? Any help is much appreciated.
2007 Apr 20
0
how to call controller from script/runner
I''d like to call a controller method or three from a script invoked via
script/runner so that I can manually populate my page cache. How would I
go about doing so?
- donald
--~--~---------~--~----~------------~-------~--~----~
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
2006 May 29
2
How to use script/runner
I''ve read the wiki and Agile and can''t find the answer.
When using script/runner I''ve gotten simple model functions similar to
the -help example to run:
$script/runner ''puts Vendor.find(1).name3''
where Vendor is a model.
However when I try to run a function in a controller it doesn''t work:
$script/runner ''puts
2007 Apr 12
1
rspec on rails: undefined method ''controller_name''
Im trying to write a controller spec, but when I run it I get an error like
the one below.
I found Bug6707
(http://rubyforge.org/pipermail/rspec-devel/2007-March/002147.html
), but I get the error no matter how I run the spec
( whether I use rake or not)
Any ideas?
I am using 0.8.2
The Error:
C:/rails/InstantRails/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/expectati
ons/sugar.rb:14:in
2008 May 07
0
Calling a controller method with a rake task - plugin errors
I have a rake task to call a controller method:
-------------------------------------
require ''action_controller''
require ''action_controller/integration''
namespace :backup do
desc "Starts automated backup procedure for all databases"
task "do_auto" do
app = ActionController::Integration::Session.new;
app.get
2007 Oct 16
6
RailsStory runner - empty response
I generated a new rails app then installed rspec and rspec_on_rails from
trunk.
I then created a sample story:
require File.dirname(__FILE__) + "/helper"
Story "View Home Page", %{
As a user
I want to view my home page
So that I can get a birds eye view of the system
}, :type => RailsStory do
Scenario "Publisher with no videos" do
When
2006 Feb 27
1
Instance methods in runner?
I am having a devil of a time with some runner actions.
I can not seem to call any instance methods on found records.
Even when I strip is down to the basics:
def self.deliver
self.find(:all, :conditions => ["#{Message.table_name}.status
= ?", ''pending''], :include => [:site, :template]).each {|m|
logger.info m.is_recurring? # my method
logger.info
2006 Jul 26
1
lesson learned: script/runner does not abort on failed require
After a fresh installation of an application, some utility scripts
run with script/runner quietly aborted right after their start. No
error message whatsoever, just a new shell prompt. The reason was an
uninstalled dependecy, but that was difficult to determine because
the load failure was not reported:
% ruby script/runner ''require "foobarbaz"''
%
Why
2007 Jun 07
0
Module Not Loaded by script/runner
Hello ~
I have a Model Action that I wish to call from script/runner. This
Model accesses another action in a module in the lib directory. If I
fire up script/console and execute Model.action it works perfectly,
but when I run the command via script/runner it cannot find the action
I want to call in my module.
If I run: script/runner "puts $:" The lib directory is shown, so the
2008 Oct 28
1
Script/Runner
I have a production site that has a couple of batch jobs, I have used
script/runner and cron to run these jobs. This works ok for jobs that
only run once overnight during off peak.
I am expiring sessions older than 30 mins every 15 mins using
script/runner, but I''m concerned about the hit of script/runner loading
up the whole rails environment, specifically since I only have a 256MB
2008 Jan 12
0
Can't test application controller methods in functional tests?
I have two methods in application controller that I want to test from
ForumController:
-----------------------
class ApplicationController < ActionController::Base
...
def logout
session[:username] = nil
session[:admin] = nil
redirect_to(request.request_uri)
end
...
def home
redirect_to(:controller => ''forum'', :action =>
2006 May 21
0
expiring cache fragments using script/runner
I''ve just set up caching on my site and want to expire some of fragments on
an hourly basis.
I was going to use cron and script/runner to do this.
For other fragments that I am expiring, I am using expire_fragment inside a
sweeper class, something like:
class QuestionSweeper < ActionController::Caching::Sweeper
observe Question
def after_validation_on_update(question)
2009 Apr 24
3
Running in non-dev envs. with script/runner shebang setup
All,
I have a script that runs script/runner via the shebang mechanism at the
top o the file, like so:
#!/usr/bin/env ./script/runner
This works fine in development, how would I get it to run in
non-development environments?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
2006 Feb 13
2
categories and admin/categories - different controllers and templates?
Is there some way to have these two sets of URLs use
totally different controllers and templates?
categories/list
categories/show/1
admin/categories/list
admin/categories/edit/1
admin/categories/destroy/1
admin/categories/update/1
Besides, of course, using different controller names
;). The first URL is publicly accessible, while the
second contains admin functions. Also, with the
second,
2007 May 31
0
script/runner permission denied
Hi,
I have been running ferret for several months now, but want to make use
of the new Drb functionality. So I am running Rails Stable (off the
branch), Ferret 0.11.4, and the latest AAF. I have a ferret_server_yml
file in my RAILS_ROOT/config folder:
production:
host: localhost
port: 9009
pid_file: log/ferret.pid
And I took the three scripts from the AAF plugin and put them into my