Displaying 20 results from an estimated 1309 matches for "applicationcontrollers".
Did you mean:
applicationcontroller
2007 Aug 14
2
Spec''ing ApplicationController
Folks,
I''d like to spec the behaviors that I''m adding to ApplicationController.
Specifically, I''m adding:
def authenticated?
session[:username] != nil
end
I described ApplicationController, but couldn''t figure out how to call the
authenticated method. I''m probably going about this quite wrongly and would
appreciate any hints?
Thanks,
Scott
--
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 <
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
2006 May 18
3
access to an ApplicationController property from a view
Hi there,
How is it possible to get access to an ApplicationController property
from a view?
Consider this (simplified) situation:
class ApplicationController < ActionController::Base
def folder_id
@folder_id = params[:id]
return @folder_id
end
end
class FolderController < ApplicationController
def show
@folder = Folder.find_by_id(folder_id)
end
end
So far,
2008 Feb 08
0
Challenge! How can I write a test to test the methods in ApplicationController?
Hi all,
I''ve been Googling this one for a while now, and haven''t found a
satisfactory answer. It has been posted here before by someone else,
but it seems to have got forgotten, so here goes - perhaps someone can
think up a way around the problem?
In ApplicationController, I have the following method:
class ApplicationController < ActionController::Base
<snip>
2006 Jun 24
7
Newbie Q: "user" variable in every view?
Newbie to RoR -- as a long time Java Struts/etc. guy it is an awesome tool!
I have implemented some basic login/session stuff with the help of a great
tutorial, props to the author (
http://www.aidanf.net/rails_user_authentication_tutorial).
I have a trivial instance method in ApplicationController, which just grabs
the User object from the session.
def current_user
session[:user]
end
2007 Nov 20
3
Plugin: can't call before_filter in ApplicationController
Hi all
I want to outsource an extension for ApplicationController, that I had
in application.rb so far, into a plugin.
I have created this plugin, and in init.rb I load
require File.dirname(__FILE__) + ''/lib/application_controller''
In lib/application_controller.rb I have the following code:
class ApplicationController
before_filter :prepare_user
...
end
This worked
2008 Mar 28
10
Inheriting from AdminController intstead from ApplicationController
Hi
I would like to do the following:
I have created an admin namespace and the required folders app/admin
views/admin etc. And then I wanted all controllers under app/admin to
inherit from a controller named AdminController which resists under
app/admin/admin.rb instead of inhereting from ApplicationController,
so I could better separate between admin and public section. The
AdminController
2008 Sep 06
6
Configuring custom library
Hi,
I''ve added a custom library called lib\AccountSystem like so:
"module AccountSystem
SINGLE = 1
MULTIPLE = 2
class << self
attr_accessor :account_system_type
end
end"
Now I wanna configure
AccountSystem.account_system_type=AccountSystem::SINGLE in one app. I
used an initializer: config/initializers/account_initialization.rb
where I put this line in.
I
2006 Jun 02
6
Set instance variable for all actions in the Controller
Can I set an application wide instance variable that is available for all
actions...and their views?
eg.
class ApplicationController < ActionController::Base
@current_user = User.find(session[:user_id])
end
and everywhere I can call @current_user.id and I can get that object? Even
down in the views?
I could not get this to work...
Thanks in advance,
Jeff
-------------- next part
2009 Aug 10
2
A copy of ApplicationController has been removed from the module tree but is still active!
Yes, more dependencies.rb fun!
As far as I''m able to ascertain, these errors started appearing after
upgrading from Rails 2.3.1 to 2.3.2 and persist in 2.3.3.
They''re highly nonderministic and appear rather sporadically, which
makes it extremely frustrating. Multiple developers on our team have
experienced this problem across varying versions of Ruby/Rails.
They''re
2008 Feb 22
7
Testing misc methods in ApplicationController
I''m already successfully testing before_filters in application_controller
courtesy of this blog post:
http://www.movesonrails.com/articles/2008/01/23/spec-ing-your-application-controller
However, i can;''t work out how to test the sort of method that is added to
application_controller so that all controllers can use it. It must be
something simple that i''m doing
2006 Jun 18
2
Why can''t I use a session? (Symbol as array index)
Hi All
I can''t for the life of me see what is wrong with this. Maybe it''s cause
it''s midnight...
I want to put some data in a session and I have some code like this:
class ApplicationController < ActionController::Base
model :mything
def ApplicationController.chosen_thing
session[:chosen_thing] ||= MyThing.defaultThing
end
end
So whenever I try to
2006 Feb 01
2
Uninitialized constant ApplicationController?
Hello list,
I''m trying to start my Rails server after doing a long complex switch
from Postgres to MySQL, and I''m getting the following error:
=> Booting WEBrick...
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in
`const_missing'': uninitialized constant ApplicationController
(NameError)
from
2007 Jun 16
2
Specs don''t find modules when using the secure_actions or ssl_requirement plugin
Hello,
I''m trying the secure_actions plugin (or ssl_requirements)
I''m installed the plugin, and added the include in application controller:
class ApplicationController < ActionController::Base
include ExceptionNotifiable
include AuthenticatedSystem
include SecureActions
...
but when I try to run the specs I got this error:
2006 Jan 29
3
SHLG and lib dir
Slowly figuring out how to get my SaltedHashLoginGenerator stuff working. The wiki page
says to put "before_filter :login_required" in the user (my "user" is "member") controller
or in ApplicationController. However, wherever I put it I get NoMethodError.
The rest of the SHLG stuff seems to be working... or at least I could get to the signup
page, register, and
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
2007 Oct 21
8
Interesting shared behaviour side-effect
Given the following ApplicationController specs:
describe ApplicationController, "one facet", :shared => true do
it ''foo'' ...
it ''bar'' ...
end
describe ApplicationController, "some other facet", :shared =>
true do
it ''abc'' ...
it ''xyz'' ...
end
describe
2006 Apr 14
1
Rendering an ApplicationController''s action
Hi !
I''ve pasted Rails Recipe #31: Authentication code, but I wish to use
these methods in several controllers. Then I pasted them in
ApplicationController, using before_filter method in all the other
needed controllers. The problem is that Rails always tries to render a
missing template inside the current controller (
app/views/controllers/admin/article/signin_form.rhtml ) while
2007 Jan 06
0
ApplicationController common view
I created a user login system in ApplicationController. There is a def
called signin. It needs a view file, signin.rhtml
I have a couple of other controllers inheriting from
ApplicationController. Where can I place the view file so it is
viewable across all controllers? I tried the root view folder but that
didn''t work.
Right now, I would have to copy and paste the signin.rhtml file