Skip to content

Loading…

Got generator working in Rails 3, when installed as gem #198

Closed
wants to merge 1 commit into from

3 participants

@pwnall

No description provided.

@hiwaylon

What's the status of getting this into master?

@pwnall

It seems like development on the plugin stopped? I guess devise is the go-to solution nowadays.

@jjb
jjb commented

hi-- i'm going to try to maintain the One True Rails 3 Fork :) please send your pull request to https://github.com/jjb/authlogic

@ghost

Thanks, these have been added through another pull request.

@ghost ghost closed this
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 26, 2010
  1. @pwnall

    Generator support for Rails 3.

    pwnall committed
View
2 lib/authlogic.rb
@@ -62,3 +62,5 @@
require AUTHLOGIC_PATH + "controller_adapters/rails_adapter" if defined?( Rails )
require AUTHLOGIC_PATH + "controller_adapters/merb_adapter" if defined?( Merb )
require AUTHLOGIC_PATH + "controller_adapters/sinatra_adapter" if defined?( Sinatra )
+
+require AUTHLOGIC_PATH + "rails3_engine/railtie" if defined?(Rails) && defined?(Rails::Railtie)
View
2 lib/authlogic/controller_adapters/rails_adapter.rb
@@ -1,3 +1,5 @@
+require 'action_pack'
+
module Authlogic
module ControllerAdapters
# Adapts authlogic to work with rails. The point is to close the gap between what authlogic expects and what the rails controller object
View
10 lib/authlogic/rails3_engine/generators/session/session_generator.rb
@@ -0,0 +1,10 @@
+module Authlogic
+ class SessionGenerator < Rails::Generators::NamedBase
+ source_root File.expand_path("../templates", __FILE__)
+
+ def create_session_model
+ class_collisions class_name
+ template 'session.rb', File.join('app/models', class_path, "#{file_name}.rb")
+ end
+ end
+end
View
2 lib/authlogic/rails3_engine/generators/session/templates/session.rb
@@ -0,0 +1,2 @@
+class <%= class_name %> < Authlogic::Session::Base
+end
View
9 lib/authlogic/rails3_engine/railtie.rb
@@ -0,0 +1,9 @@
+require 'rails'
+
+module Authlogic
+ class Railtie < Rails::Railtie
+ generators do
+ require AUTHLOGIC_PATH + 'rails3_engine/generators/session/session_generator.rb'
+ end
+ end
+end
Something went wrong with that request. Please try again.