Displaying 20 results from an estimated 35 matches for "testcontroller".
2006 Jun 07
1
What is class TestController < ActionController::Base
What are the different parts of; class TestController <
ActionController::Base?
I look at the http://api.rubyonrails.org/ and try to understand but I
don''t. Could someone give me a hint?
I get the part of Test being the "folder", def and all that, but I can''t
find an explanation of the basic stuff.
--
Posted via h...
2006 May 13
1
newbie question - routes.rb on server
...ver
space with a host who said that ruby on rails should work on the server.
All I want to do is make sure that a test ruby application works online
so that I can begin development on an app. I am able to get the test
program to work locally but not online.
In C:/ruby/projects/test/controllers/TestController.rb:
(path online = www.<mydomain>.net/test/controllers/TestController.rb)
-------------------------------------------------------------
class TestController < ApplicationController
def index
render_text "Hello Ruby"
end
end
--------------------------------------------------...
2007 Feb 15
17
Odd parameter munging with with()
Hi,
I have this setup block:
setup do
session[:login] = ''jhughes''
@user = mock("user")
User.stub!(:find).and_return(@user)
@params = {:cn => "Bilbo Baggins",
:telephoneNumber => "416-277-4418",
:mail => "bilbo at baggins.com"}
end
And then this spec:
specify "should update and save the
2006 Jul 22
3
Connection refused - connect(2)
...ActiveRecord::Base
def self.find_data
set_table_name ''cd_details''
set_primary_key ''cd_label''
find (:first,
:select => "cd_label")
end
end
[/code]
and calling this in controllers like this,
[code]
class TestController < ApplicationController
def view
@cd_details = CdDetails.find_data
end
end
[/code]
my database configuration is
adapter: postgresql
database: cdlibrary
username: cdlibrary
password: cdlibrary
If I call this action "VIEW" from test controller, I am getting the...
2006 Jun 01
9
access model from controller
Hello,
Rather new to RoR, so I''m not sure about the terminology and such :-/ .
My question is: how could I know the model which is associated to a
controller?
For example:
- controller class is TestController, which is a subclass of
ApplicationController
- associated model class is Test
How could I write some code in a method of ApplicationController to
dermine the current associated model?
So, if I have a "foo" method in ApplicationController (and no such
method in TestController), whe...
2005 Dec 29
3
Class Variable Scope
(Hopefully) a quick question about variable scope issues. In one of my
controllers, I have a class variable:
class TestController < ApplicationController
@@testClassVariable = 0
...
The problem is, in my "list" method I''m trying to increment this
variable by one each time, printing it out, but it seems to reset to 0
every time the list method is called:
def list
...
@@testClassVariable += 1
l...
2006 Sep 12
2
Cache sweeping and render_component (my mistake or Rails bug?)
Hi
I''m working on a program which relies on heavy cache sweeper usage.
I''ve just bumped onto an odd problem. When using render_component
method in layouts or templates with cache sweeping turned on, Rails
throws an exception with the following message:
NoMethodError in TestController#index
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.controller_name
where TestController is obviously my controller class name. I''m running
Rails 1.1.6 on linux box. My test app which extracts the error consists
of a controller which bod...
2006 Jul 10
2
''uninitialized constant'' error
....rb
-----------------------------------------------
class TailWorker < BackgrounDRb::Rails
def do_work(args)
puts "Printing from inside TailWorker::do_work()"
end
end
When I issue the request to
http://127.0.0.1:3000/My_Test/longrun
I get the following error:
NameError in My testController#longrun
uninitialized constant TailWorker
I''d appreciate any light thrown on what I might have done to cause this error and about how to rectify it.
Thanks,
Aravind Elango
2006 Oct 01
9
How to create a very simple form
Hi all,
I would like to create a very simple form with RoR similar to this one
in ASP.Net:
http://quickstarts.asp.net/QuickStartv20/aspnet/samples/ctrlref/standard/TextBox/TextBox1_vb.aspx
I my RoR project I want to add a Greeter class like this one:
class Greeter
def initialize(name = "World")
@name = name
end
def say_hi
puts "Hi #{@name}!"
end
def
2006 Jan 10
1
Frames
...l, I know there''s a better way (not using frames) but bear with me
while we get rev 1 out the door and then switch. In the meantime I need
to redirect from one frame into another and cannot for the life of me
figure out a reference to get to another frame:
redirect_to :controller => testController'', :action => testProc''
I cannot seem to add :target or any other similar item to tell it which
frame to redirect into. Thoughts? Help? Thanks!
_______________________
Brad Eck
Sr. Software Engineer
Pelco
3500 Pelco Way
Clovis, CA 93612
Office - 800-289-9100
Email - b...
2010 Nov 22
3
can't activate i18n (~> 0.4.1, runtime) for ["mail-2.2.10"
...3 on Mac OS X, and am running into the dependency
problems. Please see the error below. I thought bundler was meant to
precisely avoid these problems? thanks a lot for your help
I tried bundle install / check , deleted old lockfile and regenerate
it, but nothing worked.
rails generate controller testcontroller index
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:233:in `activate'':
can''t activate i18n (~> 0.4.1, runtime) for ["mail-2.2.10",
"actionmailer-3.0.3", "rails-3.0.3"], already activated
i18n-0.5.0beta1 for ["activemodel-3.0.3", "a...
2006 Jan 19
3
template/variable confusion
Hi there,
I''m having some trouble working out where/when I can define template variables.
I have a standard.rhtml layout template which is used across the application as the main xhtml wrapper.
Inside there is some code like this:
<div id="<%= @layout_style %>">
<%= @content_for_layout %>
</div>
Now content_for_layout always works fine, but
2006 Sep 25
3
Engine Yard blog
Just received the news from Tom Mornini.
Congrats Ezra for the new Engine Yard site and the blog you will be
collaborating.
Hope to read you there soon.
http://www.engineyard.com/
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060925/3f251fa4/attachment.html
2009 Mar 05
8
Can I construct the controller myself in a controller spec?
Hi
I am experimenting with Constructor based dependency injection for
rails controllers.
So I have something like this
class LoginSessionsController < ApplicationController
def initialize(authenticator = TheRealAuthenticator)
@authenticator = authenticator
end
....
end
The plan was to override the authenticator used when testing with something like
describe
2005 Dec 31
7
Application Errors w/ layout & custom view pages
1) I get Rails Application Error when trying to use layout
test_controller
def list
layout "stdlayout"
end
in the views/test/layouts stdlayout.rhtml
<html>
<head><title>test</title></head>
</body>
<h1>Test</h1>
<%= content_for_layout %>
</body>
</html>
2) I get Rails Application Error when trying to use a separate
2006 Apr 10
1
Error When Sorting
...>
<% end -%>
</ol>
#controller
def update_question_positions
params[:sortable_list].each_with_index do |id, position| #LINE 52
Question.update(id, :position => position+1)
end
render :action => "show"
end
#error
Processing TestController#update_question_positions (for 127.0.0.1 at
2006-04-09 21:51:15) [POST]
Session ID: 7d95944ce75767f42f6d4910fd432687
Parameters: {"action"=>"update_question_positions", "id"=>"5",
"controller"=>"admin/test"}
NoMethodError...
2006 Apr 25
0
Params Help to Pass variables from URL
...s and am realy quite having a problem with
passing values. I created a test folder and have 3 files:
1. Main.rhtml
<%= render_component(:controller => "test", :action => "pass") %>
2. Pass.rhtml
<%=@test%>
<%=flash[:notice]%>
3. Controller.rb
class TestController < ApplicationController
def pass
@test = "<a href=\"main?name=123\">Testing!</a>"
@passed = params[:name]
#flash[:notice] = ''456''
flash[:notice] = @passed
end
end
Well, as much as I get the url properly to simulate the passing of
variabl...
2007 Jun 10
0
pb when posting to an action "render_text body, :status => 400"
...ongrel 1.0.1 on osx where the
consumer get :
Net::HTTPBadResponse: wrong status line: "HTTP/1.1 0 "
If someone wants to try, just make a rails app :
rails test
script/generate controller test index
and in the test_controller define the action ''index'' like that :
class TestController < ApplicationController
def index
render_text "test", :status => 400
end
end
you can know test this with irb (supposing the server is running on port
3000) :
require ''uri''
require ''net/http''
url = "http://localhost:3000/test"...
2006 Mar 29
0
Bug with skip_before_filter?
...trollers in
the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
before_filter :test_filter
def test_filter
flash[:notice] = "The filter was called"
end
end
test_controller.rb
class TestController < ApplicationController
skip_before_filter :test_filter, :only => :index_no_filter
def index
end
def index_no_filter
end
end
--
Posted via http://www.ruby-forum.com/.
2006 Jan 14
0
if condition on validates_presence_of is not working
class Event < ActiveRecord::Base
attr_accessor :step_processing
validates_presence_of :name,:description , :if => (:step_processing ==
4)
end
class TestController < ApplicationController
def bar
@event = Event.new
@event.step_processing = 4
@event.name = ''foo''
@event.save
end
end
In the above code :step_processing a non-database field. It''s just there to
control the processing. The validation should take place only wh...