Skip to content

Commit

Permalink
Fixed namespaced controllers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesc Esplugas committed Feb 21, 2010
1 parent 9c148b4 commit 94e18ee
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
22 changes: 22 additions & 0 deletions README.md
Expand Up @@ -62,6 +62,28 @@ and migrate your database.
To create the first user, start the application server, go to
http://0.0.0.0:3000/admin and follow the instructions.

## Namespaced Models?

If you want to be able to use `delayed_job` you need to add the following
two lines to your `config/routes.rb` file.

map.connect "admin/delayed/jobs/:action/:id", :controller => "admin/delayed/jobs"
map.connect "admin/delayed/jobs/:action/:id.:format", :controller => "admin/delayed/jobs"

And then create and configure `config/typus/delayed_job.yml` and
`config/typus/delayed_job_roles.yml` as you do with your other models.

# config/typus/delayed_job.yml
Delayed::Job:
fields:
list: ...
form: ...
search: ...

# config/typus/delayed_job_roles.yml
admin:
Delayed::Job: all

## Support

As an experiment we encourage you to support this project by
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/typus_helper.rb
Expand Up @@ -86,7 +86,7 @@ def header

def login_info(user = @current_user)

admin_edit_typus_user_path = { :controller => "admin/#{Typus::Configuration.options[:user_class_name].tableize}",
admin_edit_typus_user_path = { :controller => "/admin/#{Typus::Configuration.options[:user_class_name].tableize}",
:action => 'edit',
:id => user.id }

Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions lib/extensions/routes.rb
@@ -0,0 +1,13 @@
class ActionController::Routing::RouteSet

def load_routes_with_typus!
typus_routes = File.join(File.dirname(__FILE__), *%w[.. .. config typus_routes.rb])
unless configuration_files.include? typus_routes
add_configuration_file(typus_routes)
end
load_routes_without_typus!
end

alias_method_chain :load_routes!, :typus

end
1 change: 1 addition & 0 deletions lib/typus.rb
Expand Up @@ -98,6 +98,7 @@ def boot!
require "extensions/object"
require "extensions/string"
require "extensions/active_record"
require "extensions/routes"

# Load configuration and roles.
Typus::Configuration.config!
Expand Down

0 comments on commit 94e18ee

Please sign in to comment.