Displaying 3 results from an estimated 3 matches for "all_controllers".
2007 Dec 09
4
Help on drying code
Hi all,
Currently I''m having to do this:
def self.authorized_roles(controller, action)
specific = self.find_by_controller_and_action(controller, action)
all_actions = self.find_by_controller_and_action(controller, ''*'')
all_controllers = self.find_by_controller(''*'')
role_ids = []
specific.each do |role_item|
role_ids << role_item.role_id
end
all_actions.each do |role_item|
role_ids << role_item.role_id
end
all_controllers.each do |role_item|
role_ids <<...
2006 Jan 23
2
UserEngine -- Permission.synchronize_with_controllers -- trouble with my own controller modules
...h the console to try to figure out what''s going on.
This line does pick up all of my controllers.
controller_files = Dir[RAILS_ROOT + "/app/controllers/**/*_controller.rb"]
But then this line doesn''t include any of my admin controllers.
ApplicationController.all_controllers.collect do |controller|
If I understand this correctly, ApplicationController is an instance
of my application.rb file in the controllers directory. Yes? Is
there something that I need to do so that it''s aware of controllers in
the subdirectories?
/app/controllers/application.rb
req...
2007 Aug 04
5
reusable specs - almost there
I have a lot of controllers with virtually identical functionality for most
actions. I''ve been using shared behaviours to DRY things up a bit, but I
still have to create separate behaviours for each context before I can use
the shared behaviours
what I have now is a generic file which contains all the behaviours and
examples common to all the controllers, and that file gets loaded from