Skip to content

Commit

Permalink
adding rails 3 generator for session model
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Saxby authored and odorcicd committed Mar 14, 2010
1 parent 74d2463 commit 905bd7b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/generators/authlogic/session/USAGE
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
15 changes: 15 additions & 0 deletions lib/generators/authlogic/session/session_generator.rb
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
2 changes: 2 additions & 0 deletions lib/generators/authlogic/session/templates/session.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class <%= class_name %> < Authlogic::Session::Base
end

0 comments on commit 905bd7b

Please sign in to comment.