Name space and before filter

is it possible to have a before filter apply to all controllers in a
name space, or do you have to do it separate for each individual
controller. for example, an admin name space with a require_admin
before filter.

On Nov 28, 4:07 pm, scott [email protected] wrote:

is it possible to have a before filter apply to all controllers in a
name space, or do you have to do it separate for each individual
controller. for example, an admin name space with a require_admin
before filter.

easiest way is to have those controllers inherit from some common
controller.

Fred

Freds tip is good, if you don’t want to do it,
you can test for the name space in the filter like:
request.path.starts_with?(’/admin’)

thanks fred, that is a clean and easy solution.

On Nov 28, 11:20 am, Frederick C. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs