forked from technoweenie/restful-authentication
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update for rails 2.0: generate routes, use current template names [Pa…
…ul Mucur]
- Loading branch information
1 parent
1a50c04
commit 0e31b9f
Showing
7 changed files
with
42 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ators/authenticated/templates/login.rhtml → ...rs/authenticated/templates/login.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Rails::Generator::Commands::Create.class_eval do | ||
def route_resource(*resources) | ||
resource_list = resources.map { |r| r.to_sym.inspect }.join(', ') | ||
sentinel = 'ActionController::Routing::Routes.draw do |map|' | ||
|
||
logger.route "map.resource #{resource_list}" | ||
unless options[:pretend] | ||
gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match| | ||
"#{match}\n map.resource #{resource_list}\n" | ||
end | ||
end | ||
end | ||
end | ||
|
||
Rails::Generator::Commands::Destroy.class_eval do | ||
def route_resource(*resources) | ||
resource_list = resources.map { |r| r.to_sym.inspect }.join(', ') | ||
look_for = "\n map.resource #{resource_list}\n" | ||
logger.route "map.resource #{resource_list}" | ||
gsub_file 'config/routes.rb', /(#{look_for})/mi, '' | ||
end | ||
end | ||
|
||
Rails::Generator::Commands::List.class_eval do | ||
def route_resource(*resources) | ||
resource_list = resources.map { |r| r.to_sym.inspect }.join(', ') | ||
logger.route "map.resource #{resource_list}" | ||
end | ||
end |