Displaying 20 results from an estimated 30000 matches similar to: "rails 3.0: ActionController::Base render()"
2012 Sep 18
4
multiple modules defining same method included into a class
In Ruby, classes are never closed: you can always add methods to an
existing class. This applies to the classes you write as well as the
standard, built-in classes. All you have to do is open up a class
definition for an existing class, and the new contents you specify
will be added to whatever''s there. In the same regard, if module is
used with the name of a pre-existing module that
2012 Sep 21
2
in Rails, what is the main (global) scope called?
For example, you see files called
rails/actionpack/lib/action_controller/base.rb
which adds methods and such to the open module ActionController. What
scope is ActionController in? Is it just called the global scope?
Obviously, there is namespace resolution lookup. And a good example of
this is in the Base class of the same file. It references one module
like this: AbstractController::Layouts
2006 Oct 19
1
Question about variable assignments/scoping after render call
I''ve got a question about how variables are made available to templates. We
have a test that looks something like this:
def test_variable_assigned
xhr :get, :do_stuff, :id => 1
assert_not_nil assigns(:thing)
end
And our app code looks like this:
class SuperClass < ActionController
def do_stuff
@parent_model = ParentModel.find(params[:id])
render :template
2006 Jul 15
2
Render -> ActionController -> Render -> ...
Hi Guys,
ActiveRecord is great for being able to drill down through many tables.
I often locate the very "top" record, and have a render :action =>
"show" display that top record.
Often I want to drill down like:
@kingdom.phylums.classes.orders.each do |order|
render :partial => "order/show"
end
But, depending on the user who is logged in, they see a
2007 Jan 03
0
`ActionController::Base#render :nothing => true` still whines about "missing template"
In FooController, I put method #bar whose only purpose is to run some
logic in the background and return a status 204 [1].
So in order to return only the 204 status code, I put at the end of
#bar:
`render :nothing => true, :status => 204`
But then when surfing to /foo/bar, I get an error about "missing
template bar.rhtml". Is this a bug?
(The solution eventually was `render
2011 Mar 30
0
Anonymous Subclass of ActionController::Base
I''m trying to spec a subclass of ActionController::Base using an
anonymous subclass but I am running into errors but I am receiving a
uninitialized constant StubResource
Here is my base class
class Admin::BaseController < ApplicationController
before_filter :etherweb_site
load_and_authorize_resource
layout "admin/admin"
protected
def etherweb_site
end
end
2008 Aug 23
0
Why ActionController::Base.class_eval for includes?
Just out of curiosity, why does action_controller.rb include classes
with class_eval instead of directly? I.e., why
ActionController::Base.class_eval do
include ActionController::Flash
include ActionController::Filters
...
end
instead of just
class ActionController::Base
include ActionController::Flash
include ActionController::Filters
...
end
--
Posted via
2007 Oct 16
1
Stub ActionController::Base#params
Has anyone had any success stubbing ActionController::Base#params? The
following is not intercepting calls to params[:foo] in my controllers:
ActionController::Base.stub!(:params).and_return(:foo => ''bar'')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071016/282a76ba/attachment.html
2010 Jan 20
0
(2.3.5) ActionController::Base.session_options[:expire_after] + Error 422/Authenticity Token Issue
I''m getting ready to put an app into production and I''ve found a
strange issue that, as far as I know, shouldn''t be happening. To me
this looks like it could be a bug, but I''m not sure and I''m hoping
some one here can tell me if they''ve seen this before, or can idiot-
check me in that hopefully it''s just something I''ve missed
2010 Jul 08
0
Rails3 -- Replacement for ActionController::Base.relative_url_root?
I have a post on stackoverflow which outlines the problem I am having:
http://stackoverflow.com/questions/3181746/what-is-the-replacement-for-actioncontrollerbase-relative-url-root
In short, I ported a rails 2.x to rails3 and started getting a
deprecation warning for using
ActionController::Base.relative_url_root. I switched to using
config.action_controller.relative_url_root and while any
2008 Jan 03
1
help - updated from 1.2.5 to 1.2.6 and getting undefined method 'session=' for ActionController::base
i start the server but it exits right away,
I ran the rake to update and changed the version string in config.rb.
Any thoughts on this matter would be appreciated.
i imagine that it has something to do with the session, but i am not
able to figure it out.
my config/config.rb has the following
config.action_controller.session = {
:session_key => ''c3_rails_session'',
2009 Jul 14
1
How to add after_filter-style render
Hello
I would like to execute specific action rendering something into page
after each of my ajax calls. In example I would like to update some
div or display an alert.
How I imagine it could work is as follows
class ApplicationController < ActionController::Base
after_filter :do_something_after_each_ajax_call
def do_something_after_each_ajax_call
if request.xml_http_request?
2007 Jan 25
1
render rhtml templates in worker
I''m trying to make a worker that will render a large page to a file,
very similar to what rails'' builtin cacheing does except with the
rendering done outside of rails.
The only advice I''ve found is to use
ActionController::Integration::Session.new but this doesn''t seem to
allow setting session variables the way the functional tests do. Is
there a way to
2012 Feb 01
6
Does Devise make use of a "status" method? Weird bug.
So I''ve inherited a legacy application and I''m trying to work around the
edges as I put an admin tool interface on top of the existing code base.
I install Devise for user authentication, since I''ve used it in the
past. I change none of the default code. And yet, on successful sign
in, I get an error:
Render and/or redirect were called multiple times in this action.
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 http://www.ruby-forum.com/.
2009 May 15
0
Undefined method `rescue_responses' for ActionController::Base:Class in Rails Edge
Greetings. I just started a new rails project basing off the edge.[1]
I prefer to unpack my gems, but when I did so, I received the error
below. Anybody else encounter this and have a suggestion?
$ rake gems:unpack
(in [omitted])
rake aborted!
undefined method `rescue_responses'' for ActionController::Base:Class
(See full trace by running task with --trace)
Thanks,
Ben
--
[1]:
2007 Dec 16
0
Specifying asset hosts via a proc (ActionController::Base.asset_host)
Hi all,
I just submitted a patch that would allow you to pass a proc to
ActionController::Base.asset_host rather than just using a %d
wildcard (e.g. assets%d.example.com). Basically this frees you from
the hard-coded assumption that you have 4 hosts numbered 0-3 and also
allows you to do smarter things depending on the asset (e.g. images
from a particular domain, stylesheets from another). The
2011 Jun 23
0
Exception in ActionController::Base:Class for "first request only"
Hi,
I am running Rails 3.0 with Ruby 1.9.2 (compiled from source) on
Ubuntu 10.04.1 (Lucid Lynx) 32-bit.
About a week back I started seeing this weird exception for a
particular request and that too only for the "first time", every time
after I restart my server (WEBrick in this case). All subsequent
requests are fine. If the same request made again, it works fine.
Here is the
2006 Jul 04
0
ActionController::UnknownAction hangs application
I''m trying to override rescue_action_in_public() using the PP example,
but my application hangs every time I generate an error.
def rescue_action_in_public(exception)
case exception.class
when ActiveRecord::RecordNotFound,
ActionController::UnknownAction
render( :file => "#{RAILS_ROOT}/public/404.html",
:status => "404 Not
2008 Jan 22
0
Trying to spec ExceptionNotifiable behavior
Hello List.
I''m trying to overwrite part of ExceptionNotifiable
(ExceptionNotification plugin) to render customized error 500 pages
based on browser agents.
For this, I''ve created a fake controller that inherits directly from
ActionController::Base:
class FooExceptionController < ActionController::Base
include ExceptionNotifiable
# this action should not fail, used for