Displaying 20 results from an estimated 90000 matches similar to: "How to protect all controllers under a module"
2007 Dec 03
2
before_filter application => exclude some other controllers
Hello again,
It''s possible to use before_filter in the application_controller, and
exclude for some methods from other controllers ?
i have a before_filter in application_controller that checks if the user
is logged, if the time hasn''t expired, ... and I want to exclude some
methods of this check, like the login. This ''login'' belongs to other
controller.
I
2006 Feb 08
2
Protecting controllers - looking for a DRY solution
Hello everyone,
I''ve got several different user roles (i.e. admin, user, guest, ...)
and have set up a bunch of controllers for each user role.
I''m trying to set up some sort of validation that the user accessing
e.g. the admin/subjects controller has the ''admin'' role. The brute
force way to do this would be something like:
- for each controller, put in
2009 Feb 08
2
SocketError in EmailController#correspond
SocketError in EmailController#correspond
getaddrinfo: no address associated with hostname.
Please see above, these are the errors i get when i try to email a user
on my networking site. Can you help please.
Actionmailer address = smtp.vodafone.ie
Below is code used for the email controller in
apps/controllers/email_controller.rb There doesnt seem to be any code
missing. Can someone help with
2008 Jul 29
0
handling multiple lookup tables in rails
I''ve got an application that will have a handful of lookup tables. To
be clear by this I mean tables that only have two attributes, id, name
and are used to provide drop-down lists for other tables/forms so that
these fields have "standard" values. I need 5 to 10 of these tables.
I''m a ruby/rails neophyte but I''ve read Agile Web Devel with
Rails, Rails
2007 Jul 20
3
Mozzila Logout back button issue
Hello,
I have recently created an application in Rails which makes use of a
login and logout system. I have a user controller and model as well as a
login controller. My login controller performs my logout and login
functions. The user is a scaffold of my database table and is auto
generated from rails.
def process_login
#Creates the user with the form variables i have not included the
2008 Mar 03
3
Admin and standard controllers RESTFully
Hello. I will appreciate the opinion.
What is the standard way of separating admin functions from normal-
user functions?
before_filter in one controller?
Use two controllers, i.e. ProductController and Admin/
ProductController?
I want to use map.resources so RESTFul would be better.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to
2006 Dec 11
0
auth_generator 2.0.1 undefined method `login_required' for ... ArticlesController
I am a relative RubNub and attempting to implement auth_generator v.2.0.1.
I am getting an "undefined method `login_required'' for
#<ArticlesController:0xb732c0b4>" error when I attempt...
http://localhost:3000/articles/new
Help would be appreciated.
My app/controllers/application.rb reads...
------------------------------------------------------------------------
2007 Jul 31
0
Edit not working with named routes
HELP! I''m a relatively new rails user and I''m stuck. I''m trying to
build a relatively simple blog and I decided that I liked the way
named routes look in the code. So I added
map.resources :posts
to my routes.db file. I then went through and updated my controller to
take advantage of the named routes that were generated. I also updated
all of my views and everything
2006 Mar 30
1
flash, before_filter and redirect_to
I leave a notice in the flash and do a redirect from a before_filter.
Can someone confirm that the first request after this, i.e. the page I
redirect to, doesn''t/isn''t supposed to clear the flash?
--
View this message in context: http://www.nabble.com/flash%2C-before_filter-and-redirect_to-t1367103.html#a3665933
Sent from the RubyOnRails Users forum at Nabble.com.
2009 Feb 25
3
Secure but elegant destruction method
Hi,-
I am looking for a clean and secure way for an ActiveRecord instance to
delete itself. Say I have a User model in my app. Then the destructive
action would be /users/user_id/destroy. If this action is not secured by
a filter like:
(*) before_filter :check_administrator_role, :only => :destroy
then any user could potentially log in and start issuing:
/users/1/destroy
/users/2/destroy
.
2007 Jan 21
0
Functional Test Fails with before filter in application.rb
Hi There,
I am trying to write my first tests for a role bassed authentication
taken from Rails Recipies. Whenever I add:
assert_redirected_to :action => ''login''
I get the following error:
NoMethodError: undefined method `first'' for :user:Symbol
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/assertions/response_assertions.rb:72:in
2009 Feb 21
1
undefined method user_id
Basically, Im trying to add comments to photos that other users have
uploaded. And Ive encountered an error:
NoMethodError in CommentsController#create
undefined method `user_id='' for #<Comment:0x4768cd0>
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1857:in
`method_missing''
2008 Jan 30
1
Can before_filter using Proc and specify block ?
Hi,
I see from this post
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/97e333daab05b725/8252c90cb9c36f6d?lnk=gst&q=passing+parameter+before_filter#8252c90cb9c36f6d
it can specify the Proc in the before_filter function, but when
specify when action apply this filter, it raise an syntax error, such
as rthe following code
before_filter {|controller|
2006 Dec 10
5
model-controller-paradigm: What about admin controllers?
Hi all
We all know the model-controller-paradigm: I have a model "News" which
has a corresponding CRUD-controller "NewsController".
But now I''m quite unsure about the following...
Guess we have normal visitors that visit our site www.??.com/news and we
have administrators that create and modify news items.
The admin should see an "Edit" link and a
2006 May 10
0
Ezra''s acl_system2 and flash not getting populated in functional tests
Hi all,
I am using the LoginGenerator and Ezra''s acl_system2 to protect
certain actions in my controllers. I have written some functional
tests to check for correct handling of redirects, flashes, etc. The
flashes however only get populated on the first get action in any
given test. Here is what I have so far:
In the controller:
class PageController < AC
before_filter
2008 May 06
12
Why before_filter is not working?
I have been scratching my head on this one for most of the day.
Hopefully someone can help explain why before_filter isn''t working for
my codes.
In my Application controller, I have this:
before_filter :login_required, :except =>
[:newacct, :create_newacct, :passwd_reset ]
def login_required
unless session[:user_id]
flash[:notice] = "Please log in"
2006 Nov 21
2
before_filter in actionwebservice controller using direct dispatching
The docs say that for direct dispatching mode to use controller
filters, but when the controller is run I get the following error.
The authorize method is in application.rb. Works fine when it''s not a
web service api. Should I be using before_invocation instead even
with direct dispatching mode? Or can I not have the authorize method
in application.rb?
undefined method
2008 Aug 31
6
why's my course_duration being reset
Can''t get this?...I''m close I think, my calculation appears to be
working, but.... when i access duration = <%= @enquiry.course_duration
%><br> in my final view it''s blank.. course_duration is getting set to
null but works for the calculation?
controller..
----------
class EnquiriesController < ApplicationController
layout ''welcome''
2007 Dec 04
1
spec''ing shared controller methods
I want to isolate and spec methods that are shared by controllers,
and live in application.rb.
Whereas I usually also provide examples in individual controllers
that use these methods, not necessarily all the edge cases and I''d
like to isolate the examples.
This is the approach I''m taking (thanks to bryanl for suggestions and
http://pastie.caboo.se/123626). WDYT?
This
2009 May 15
0
[PATCH server] final cleanup for service layer refactoring.
I've pulled out the no-longer-necessary remnants of the old way of handling auth and before_filters as well as fixing a couple bugs that had crept in along the way.
Unit test fixes for the refactoring will follow in a subsequent patch.
Signed-off-by: Scott Seago <sseago at redhat.com>
---
src/app/controllers/application.rb | 46 ----------------