similar to: How do I call a controller from a model, console, or outside of rails?

Displaying 20 results from an estimated 10000 matches similar to: "How do I call a controller from a model, console, or outside of rails?"

2006 May 26
8
calling render_to_string outside of controller
How can I call render_to_string outside of a controller. I''m stuck on this. I''ve nearly got my plugin finished but I can''t seem to get this to work. The method is in ActionController::Base but it is protected. -- Posted via http://www.ruby-forum.com/.
2008 May 22
2
Story / Redirection to static html within public
With a rails application I''m trying to access the public/ folder from within a rspec story. I have a controller which redirects to: /public/static_html_page.html I have a story written using webat. This story uses the above controller and it expects the redirection. This story always fails as within the story it cannot follow the redirection (Always gives a 500 error). It does not
2006 Jul 31
1
Starting backgroundrb from rails and restarting with rails
Hi, I have my rails sites tricked out with capistrano, and backgroundrb, so I can easily use the ant tasks, but I would like to be able to start and stop backgroundrb from within rails. I have a few reasons for this: 1. Using fastcgi, backgroundrb would start under the apache user and the same mod_security context as apache, instead of my developer account which has many more privileges. 2.
2005 Dec 14
2
console and webrick problems
Hi, I''m having errors when running webrick or the console. webrik starts, but give me an error when I try to load my controller. It give the same error as the console: #ruby script/console Loading development environment. /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/console.rb:23:in `exec'': No such file or directory - irb -r irb/completion -r
2006 Nov 29
6
Noob needs help installing backgroundrb on Windows XP
Hey Guys, In the readme for Backgroundrb it says that windows support has been depcreated for this version, but then it goes on to mention how to use it in Windows. So I''m not sure if it should be running on windows or not, so I''ll ask anyway. Also, I''m new to ruby and I''m also new to server administration, so I apologize if my questions are pretty
2006 Jan 23
3
running rake commands from rake migrate
Hi there, How can I run rake commands from a rake migration? I''m looking to run rake engine_migrate and others commands from a migration in order to migrate my engines along with my core app. Any advice is appreciated. Thanks, Jason
2006 Apr 04
1
integration tests - 1.1
I?m using the new 1.1 integration test facility? I?m trying to write a test that sees if a controller redirects to the correct place and preserves the query string. Here?s the code: class LoginRedirectTest < ActionController::IntegrationTest def test_non_admin_auth request_uri = "/datafeed/event/report?blah=blah" get(request_uri) follow_redirect!
2005 Dec 18
3
automatically generate migration from db/SQL?
Hi, I''d like to use migrations to build my initial database. Is there a gem or plugin that will generate the migration code for initial db if I point it at a live database or sql file? If yes, then can you automatically generate the incremental migrations as well? Thanks, Jason
2007 Nov 13
7
rails story runner returning a nil response code
Has anyone noticed any problems with the Rails story runner returning a response code of "0" when doing get/post/etc methods? I just grabbed the latest rails/rspec and just started noticing this problem, http://pastie.caboo.se/117497 Regular controller specs pass as expected. -- Josh Knowles phone: 509-979-1593 email: joshknowles at gmail.com web: http://joshknowles.com
2007 Nov 25
2
Fwd: Render_to_string from a worker
Hi, I am trying to generate a PDF from within a worker using PDF::Writer. In my controller I use render_to_string to create the pdf file however from what I understand render_to_string can only be used from a controller. Does anybody have any suggestions how I might be able to replicate this functionality in a worker? -- thanks, Felix -------------- next part -------------- An HTML attachment
2007 Jan 09
1
assert_redirected_to not working as expected
I''ve installed the "acts_as_authenticated" plugin and made some modifications to the controller (app/controllers/account_controller.rb) "signup" module as follows: === def signup @page_title = ''Create Account'' @user = User.new(@params[:user]) if request.post? if @user.save session[:user] = User.authenticate(@user.login,
2006 May 04
6
second assert_tag failling in rails integration test
Hi all, I''m fairly new to rails and ruby, but I''ve come across an interesting glitch and I''m not sure whether I''ve just got something wrong with my assumptions or if it really is an error in the underlying framework... I''ve created a bare-bones set of tests to show you where the problem is. What follows are the steps I went through to reproduce the
2007 Dec 24
1
Uninitialized constant in integration test
I am seeing weird issues when trying to create integration tests. Here is a very simple example of something that is failing. The assert_redirected_to, and other methods, fail with this or similar exceptions. I have tried requiring both ''application'' and ''listings_controller'', but neither solves this problem, although the exception changes. Anybody know
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 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,
2006 Jul 27
3
timer service
hi everyone, I have this case where I need to check some records in the database of a specific data condition every 5 seconds and do some business logic if this scenario is true. Problem is there doesn''t seem to be any timer service in the rails framework. Anyone have a general idea of how to attack this problem? thanks, -dan -- Posted via http://www.ruby-forum.com/.
2008 Sep 18
1
PDF fonts problem
Dear List, I am writing a paper in Hungarian, that I Sweave and than pdfLaTeX. Everything is fine, except for two accented letters in the graphs that behave strange, though on the screen and in eps exports they look perfect. The problem is that I need pdf graphs, since I would like to have a PDF after LaTeX-ing. For the example below I downloaded the following two font sets: 1. Latin Modern
2012 Oct 21
1
load_missing_constant
I have a model ''site'' defined in a sub-folder ''cms'' class Cms::Site < ActiveRecord::Base ..... the model is loaded correctly , checked in console: application.rb config.autoload_paths += Dir["#{config.root}/app/models/**/"] console >Cms::Site.all => [] Now trying to access this model from a sites_controller ( in backoffice/cms
2006 Jan 31
2
Setting a default order for a model?
Hi, I''m using a room model throughout my code. I keep doing the following: @rooms = Room.find(:all, :order => ''buildings.name, room_number'', :include => :building) I have to copy this into several of my controllers and I feel that I''m violating the DRY principle. Can I set this as the default order in my model? If so, how would I do that? Thanks,
2006 May 29
1
Substruct 0.7 now here!!!
I''ve just pushed the latest version of Substruct, everyone''s favorite CMS/E-commerce project out the door. http://dev.subimage.com/projects/substruct/ is the home page if you''re unfamiliar with it. The release is available here: http://subimage.com/files/substruct-0.7.tar.gz And install instructions here: