forked from binarylogic/authlogic
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding rails 3 generator for session model
- Loading branch information
Showing
3 changed files
with
22 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Description: | ||
Creates a session model for use with Authlogic | ||
|
||
Usage: | ||
rails generate authlogic:session NAME |
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,15 @@ | ||
module Authlogic | ||
class SessionGenerator < Rails::Generators::NamedBase | ||
desc "Description:\n Creates a session model for use with Authlogic" | ||
|
||
def self.source_root | ||
@_auth_source ||= File.expand_path("../templates", __FILE__) | ||
end | ||
|
||
def copy_initializer | ||
m.class_collisions class_name | ||
directory File.join('app/models', class_path) | ||
template 'session.rb', File.join('app/models', class_path, "#{file_name}.rb") | ||
end | ||
end | ||
end |
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,2 @@ | ||
class <%= class_name %> < Authlogic::Session::Base | ||
end |