Displaying 20 results from an estimated 48 matches for "foocontrol".
Did you mean:
flowcontrol
2001 Feb 11
2
splitting up optional args
Hi,
A question (& possible suggestion) about function calls.
Is there an R idiom to eliminate the redundancy in the
following common situation?
foo <- function(x, control=ComplicatedDefault) { etc. }
plotfoo <- function(x, foocontrol=ComplicatedDefault, ...) {
y <- foo(x, control=foocontrol)
lines(x,y,...) }
The idea is that there are MANY optional parameters to plotfoo().
Any specified value for foocontrol should be passed to foo(), and the
other options should be passed to lines() via &quo...
2007 Nov 23
12
namespaced controllers
Out of curiosity, I''ve seen the following fail:
module Admin
describe MyController
...
end
end
But this works fine:
describe Admin::MyController
..
end
Why?
Scott
2007 Aug 04
5
reusable specs - almost there
...in.com/m6b47bae9
It works great when I run the specs individually, but when I use rake, specs
begin to fail and i think it''s because the value of kontroller() is set to
whatever it returns the first time it gets called. Here''s the rake output
from running the specs shown above:
FooController
.FooController
.
Finished in 0.041793 seconds
2 examples, 0 failures
I would expect it to print FooController and then BarController ...
interestingly, if I insert ''puts kontroller.to_s'' *outside* of the describe
block, then it does output the names of both controllers as exp...
2007 Sep 27
1
rspec_on_rails: controller method not getting called
In my rspec_on_rails controlle rspec, I have this:
require File.dirname(__FILE__) + ''/../spec_helper''
describe FooController, "with a foo" do
it "should be false" do
get ''index''
assigns[:foo].should be_false
end
end
In my controller I have this:
class FooController < ApplicationController
def index
@foo = FALSE
end
end
But the result of running the spec i...
2005 Dec 15
5
initialize called more than once?
Hi,
In my test case below, it seems that ''initialize'' is called everytime
''hello'' is called. Is this by design, a bug, or my pilot error?
class FooController < ApplicationController
def initialize
print "\n initialize \n"
end
def hello
print "\n hello \n"
end
end
I thought initialize will be called exactly once when the controller is
constructed and not when an act...
2006 Mar 09
4
Stop users accessing methods.
Hello all.
Is there a way to stop users from being able to access a controllers
methods without affecting the ability of other controllers to use them?
i.e
FooController
def secret
#Stuff
end
end
BarController
def index
redirect_to :controller => ''foo'', action => ''secret'', :id => ''007''
end
end
But directly accessing the URL server.com/foo/secret/007
would return a "Not found&q...
2006 Feb 03
4
(BUG in svn/trunk?) - superclass mismatch for any subclass of ApplicationController
I track svn/trunk of Rails using svn:externals
Some change to Rails committed in the last 1-2 days broke my subclass
of ApplicationController
The example, below, works with Rails 1.0, but in today''s svn, it dies
with the following error:
"superclass mismatch for class FooController"
class ApplicationController < ActionController::Base
end
class FooController < ApplicationController
end
The reason I''m emailing the list instead of filing a bug report is to
see if anyone knows if this change was intentional. I hope not,
because I really do need to hav...
2006 Apr 29
1
reloading include-modules inside controller not working
Hi guys,
I would expect an ActionController-derived class to reload _completely_ in
development mode.
class FooController < ApplicationController
include FancyStuffSupport
def index
# bla
end
# more actions here
end
However, the ''FancyStuffSupport'' is not reloaded, only the ''FooController''
itself. Can this behaviour be changed? I feel back in Java when I have...
2008 Apr 29
1
Spec''ing controller macros
...o longer seems to be actually called (ie a breakpoint placed
in the index method is not triggered)
2) I receive the following error:
Spec::Mocks::MockExpectationError in ''ApplicationController should turn off
session management for requests made by robot user agent''
Mock ''FooController'' expected :session with (:off) but received it with (no
args)
./spec/controllers/application_spec.rb:19:
Any suggestions?
Thanks much,
Matt
describe ApplicationController do
class FooController < ApplicationController
def index; render :text => "foo"; end...
2007 Aug 31
2
Can module spec "behave like" controller spec?
Hello everyone:
Right now I am writing spec on modules, which are provided by my
colleagues. Some of the modules actually contain action methods. I tried
very hard to spec those action methods in modules. But it seems that the
rspec does not allow module spec to ''get'' action like controller does. After
I saw the documentation, I then used :behaviour_type=>:controller.
2006 May 11
1
rendering in after_filter
Hi!
Is it possible to render the action within the after_filter method, or
is the rendering performed before?
I have something like this:
class FooController
after_filter :send
def a
@content=...
end
def b
@content=..
end
protected
def send
send_data(@content,...)
end
end
However, when calling the action a or b, the @content doesn''t get sent,
but instead rails shows an error message abour missing template.
--...
2005 Dec 20
2
printing/logging during tests
Hi all,
I''m trying to output some info to see what''s happening in a controller
during functional tests.
Problem: ''print'' only works in the test code, but not in the production
code that''s being called by the tests.
Example:
In FooControllerTest:
def test_list
print "1: starting" <<----- WORKS FINE
get :list
end
In FooController
def list
print "2: inside" <<----- DOESN''T WORK
logger.error "2: inside too" <<---...
2005 Feb 15
1
Modules Beta Comments
I''m not sure but I think this is due to the ''modules'' support in the
latest beta gems.
In some controllers I include small utility classes that only make
sense for that controller. Something like this:
class SantasLittleHelper < Foo
end
class FooController < ApplicationController
end
Where Foo is defined in RAILS_ROOT/lib/foo.rb
What I am seeing now with this new beta is this:
#<NameError: uninitialized constant Controllers::SantasLittleHelper>
The ''Controllers::'' part makes me think this has something to do with...
2006 Apr 22
3
Making a separate admin zone
Hi, im building a little cms and i want to separate the admin zone
controllers in a subfolder(controllers/admin) if possible to all be
managed by one login module, i just have managed simple 3 or 4
controller apps so any help you can give me will be very apreciated.
;)
--
Posted via http://www.ruby-forum.com/.
2006 May 25
5
Setting a global before_filter action in application.rb
Can you set a global before_filter action in application.rb?
So, for example, you could control authentication for all of the
controllers in an app.?
Obviously, you would need a way to reference actions by controller
within this "global before-filter".
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
2008 Mar 14
3
ActionController <-> ActiveView code access ambiguity
Hi All!
This is not a problem in general but i''ve just missed the point.
If my application has a global state, which i have to use both
throughout ActionController and ActiveView, then, where to place that
state?
E.g. if I do this:
class ApplicationController < ActionController::Base
protected
def authenticated?
!user.nil?
end
end
then I can''t use that from any
2010 Apr 14
4
module/class question
Are these two below the same thing?
1. module X
module Y
class Z
2. class X::Y::Z
--
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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
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
2006 May 31
7
How do you create a controller & view to create a list of objects?
...lt;%= i %>_name"/><br/>
9: <%= text_field ''bar[]'', ''name'' %></p>
10: <% end %>
11:
12: <!--[eoform:foo]-->
Hmmm... so I guess I need a bar array that is initialized with Bar objects?
So I add this to the new method in the FooController:
@bars = []
5.times do |i|
@bars.push Bar.new
end
But then I get this error:
undefined method `id_before_type_cast'' for #<Array:0x3925ee8>
Extracted source (around line #9):
6:
7: <% 5.times do |i| %>
8: <p><label for="bar_<%= i %>_...
2008 May 06
1
specifying output of render call
...;)
render :update do |page|
page << "location.href=''#{url}''"
end
end
Is it possible/advisable to specify either the block passed to render or the
output of the helper, something like below? The only way I have been able
so far to spec this was to create a FooController with an index action that
called the method and then checked the response.body, but that seems like a
lot of overhead to test such a simple method. Is there a better or obvious
way to do this?
Thanks!
Matt
it "should render javascript to redirect the browser" do
self.should_receiv...