Displaying 20 results from an estimated 10000 matches similar to: "ActionController parameters and conditional select"
2007 Aug 15
4
nuby: how spec redirect_to at ApplicationController
Good morning rspec people!
Still rspec nuby: I must do something wrong obviously.
How can I spec about redirect_to at ApplicationController
describe ApplicationController do
it "method login_required should redirect to home path without login" do
pending "I tried to use controller.login_required.should be_redirected
and got NoMethodError with nil object
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
2010 Jan 18
0
rails 3.0: ActionController::Base render()
Can anyone explain where render() comes from in
ActionController::Base?
I managed to trace it down only that far:
ActionController::Base includes ActionController::Rendering where
render() method is defined. This definition however calls to render of
the superclass. Superclass is ActionController::Metal. Which in its
turn inherits from AbstractController::Base. None of those have render
() either
2011 Apr 12
0
Suppress ActionController::RoutingError in logs
My rails log get chock a block with things like
<<<<<<<<<<<<
ActionController::RoutingError (No route matches "/admin/Y-
ivrrecording.php" with {:method=>:get}):
...
ActionController::RoutingError (No route matches "/manager/html" with
{:method=>:get}):
..
ActionController::RoutingError (No route matches "/webdav/test" with
2006 May 03
2
Conditional statement style
This is a bit of a nuby question methinks but i''ve had a play/search
around and it''s just bugging me now :0)
Say I have a conditional statement, testing a variable against a number
of values. The first way i did this is like so:
if myvar != "" and myvar != 0 and myvar != nil
# .. code
end
This seems a bit messy - is there neater way of doing this? I thought of:
2014 Mar 31
0
Rails Engine ActionController::UrlGenerationError on functional tests
Hi,
I'm looking for a way to solve an error I get each times I run my
functional tests. I have a Rails Engine gem (isolated), I have a JSON
action with a route declared. But each times I use the method get in a test
I get an ActionController::UrlGenerationError exception.
Here an example of code with the problem:
# config/routes.rbMyEngine::Engine.routes.draw do
resources :cats, only:
2007 Jul 01
0
rake: uninitialized const ActionController::TestUploadedFile
Hi,
My app uses attachment_fu and I''d like to pre-load some data via a rake
task.
Thus:
[code]desc "Upload template files"
task :upload_files_test => :environment do |t|
conf = Conference.find(1)
[{:f => ''styles.css'', :type_code => ''css'', :content_type =>
''text/css''}].each do |i|
file =
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
2023 Nov 04
2
I need to create new variables based on two numeric variables and one dichotomize conditional category variables.
I might have factored the gender.
I'm not sure it would in any way be quicker. But might be to some extent
easier to develop variations of. And is sort of what factors should be
doing...
# make dummy data
gender <- c("Male", "Female", "Male", "Female")
WC <- c(70,60,75,65)
TG <- c(0.9, 1.1, 1.2, 1.0)
myDf <- data.frame( gender, WC, TG )
#
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'',
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
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
2008 Aug 01
1
rescue_from ActionController::MethodNotAllowed
Hello,
I''m having some trouble handing ActionController::MethodNotAllowed
errors. Basically, the following is defined in my controllers, but
obviously I''m missing something. Thanks in advance for any light you
can shed.
- - - - - - - - - - - - - - - - - - - -
class UsersController < ApplicationController
rescue_from ActionController::MethodNotAllowed, :with
=>
2008 Mar 03
0
Overriding ActionController method in an app
i can''t seem to get this working... basically, i want to use a patch
that was added to rails:
http://dev.rubyonrails.org/changeset/8785
but i don''t want to have to upgrade past 2.0.2, and i don''t want to
have to freeze rails inside the app.
so i was hoping to override the methods in ActionController required
to make the patch to my app only. i created a file called
2008 Jan 16
0
REST Web Service ActionController::InvalidAuthenticityToken
I am trying to write a REST web service
testing locally is fine but whane I deploy the server and try test it
via curl
curl -i -X POST -H ''Content-Type:application/xml'' -d ''''
http://mytesteddomain.tld/user/posts/createReference.xml
I get an error :
ERROR TYPE: ActionController::InvalidAuthenticityToken
ERROR MESSAGE:
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 Nov 21
1
uninitialized constant ActionController::Caching::Fragments
Hey, i''m trying to use "s3cache" plugin with my app, but after adding it
to my vendor/plugins directory and following the install steps i''m
getting this error after running script/server:
/Users/richardschneeman/Documents/AptanaStudio/slangasaurus/vendor/rails/activesupport/lib/active_support/dependencies.rb:275:in
`load_missing_constant'': uninitialized
2023 Nov 05
1
I need to create new variables based on two numeric variables and one dichotomize conditional category variables.
There are many techniques Callum and yours is an interesting twist I had not considered.
Yes, you can specify what integer a factor uses to represent things but not what I meant. Of course your trick does not work for some other forms of data like real numbers in double format. There is a cost to converting a column to a factor that is recouped best if it speeds things up multiple times.
The
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
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