Authlogic Rails 3

hello,

Does anyone have authlogic working with Rails 3? When i try to
generate a session using “script/rails generate session user_session”
i get the error “No generator named session found”.

Anyone hit this ?

On Thu, Feb 18, 2010 at 7:16 PM, [email protected] <
[email protected]> wrote:

hello,

Does anyone have authlogic working with Rails 3? When i try to
generate a session using “script/rails generate session user_session”
i get the error “No generator named session found”.

Rails 3 doesn’t use script/ any longer. You’ll need to use one
of the following:

rails generate session user_session

or

rails g session user_session

However, I remember seeing something on the following page indicating
that
it’s not
compatible with Rails 3:

http://railsplugins.org

Good luck,

-Conrad

On Thu, Feb 18, 2010 at 7:24 PM, Conrad T. [email protected]
wrote:

Rails 3 doesn’t use script/ any longer. You’ll need to use one
compatible with Rails 3:

http://railsplugins.org

Good luck,

-Conrad

One user reported that adding the following to the Gemfile allowed
things to
work:

gem “authlogic”, :git => “git://github.com/binarylogic/authlogic.git”

-Conrad

thanks conrad, getting closer. now i see the error

$ bundle check
Could not find gem ‘authlogic (>= 0, runtime)’ in
git://github.com/binarylogic/authlogic.git (at master).
Source does not contain any versions of ‘authlogic (>= 0, runtime)’

Just skip to bundle install

On Feb 18, 11:02 pm, “[email protected]

I don’t think the generator works in rails3. Just create the file
yourself:

class UserSession < Authlogic::Session::Base
end

On Feb 18, 11:16 pm, “[email protected]

thanks getting closer, but same error as originally.

$ grep authlogic Gemfile
gem “authlogic”, :git => “git://github.com/binarylogic/authlogic.git”

quadro:~/$ bundle check
The Gemfile’s dependencies are satisfied

quadro:~/$ rails g session user_session
Could not find generator session.

I think
$ script/generate
has been replaced with
$ r g
in Rails3

Am I right?

I am now getting an error
irb(main):002:0> u = UserSession.find(1)
NameError: uninitialized constant AuthLogic

$ grep authlogic Gemfile
gem “authlogic”, :git => “git://github.com/binarylogic/authlogic.git”

$ bundle check
The Gemfile’s dependencies are satisfied

For some reason bundle pack doesnt pack the gem into vendors/cache but
bundle check succeeds. Any ideas?

On Fri, Feb 19, 2010 at 1:08 AM, RaW [email protected] wrote:

I think
$ script/generate
has been replaced with
$ r g
in Rails3

Am I right?

You’ll need to do the following in Rails 3:

rails g model user_session

Then just edit the file and you should be good to go.

Good luck,

-Conrad

On Fri, Feb 19, 2010 at 12:42 PM, [email protected] <
[email protected]> wrote:

I am now getting an error
irb(main):002:0> u = UserSession.find(1)
NameError: uninitialized constant AuthLogic

Try using the following line within your Gemfile:

gem “authlogic”

If that doesn’t work for you, I would try to install it as a plugin:

script/plugin install git://github.com/binarylogic/authlogic.git

Note: If you install it as a plugin, then you’ll need to remove the
reference from the Gemfile.

Good luck,

-Conrad

On Fri, Feb 19, 2010 at 2:37 PM, Conrad T. [email protected]
wrote:

gem “authlogic”

If that doesn’t work for you, I would try to install it as a plugin:

script/plugin install git://github.com/binarylogic/authlogic.git

Note: If you install it as a plugin, then you’ll need to remove the
reference from the Gemfile.

If the above two options doesn’t work for you, then I recommend filing a
ticket against this gem
on github.com.

-Conrad

Conrad T. wrote:

On Fri, Feb 19, 2010 at 1:08 AM, RaW [email protected] wrote:

I think
$ script/generate
has been replaced with
$ r g
in Rails3

Am I right?

You’ll need to do the following in Rails 3:

rails g model user_session

Then just edit the file and you should be good to go.

Good luck,

-Conrad

thanks conrad
so we scrap the rails generate session user_session
and just make a new model??

For those who are struggling after backtracking and debugging the
code, i had no choice but to put this in an initializer in the app

Authlogic::Session::Base.controller = ‘UserSession’

not sure why this is necessary but it looks like the controller
variable was not making it through to be set which was raising
exceptions. My guess is this is related to the new way rails 3
plugins work, but not 100% sure yet.

Sent from my iPhone

On Mar 24, 2010, at 10:06 AM, Ken F. [email protected] wrote:

thanks conrad
so we scrap the rails generate session user_session
and just make a new model??

Yes, the generators within Authlogic haven’t been updated for Rails
3. Thus, you’ll need to manually create the required model for your
application.

Good luck,

-Conrad

it worked for me. just follow the guide
(GitHub - binarylogic/authlogic_example: An example rails app using the Authlogic authentication library) but in your Gemfile
use:

gem ‘authlogic’, :git => ‘git://github.com/odorcicd/authlogic.git’,
:branch => ‘rails3’

and to generate a session:

rails g authlogic:session user_session

these should work great

Quinn Quinn wrote:

it worked for me. just follow the guide
(GitHub - binarylogic/authlogic_example: An example rails app using the Authlogic authentication library) but in your Gemfile
use:

gem ‘authlogic’, :git => ‘git://github.com/odorcicd/authlogic.git’,
:branch => ‘rails3’

and to generate a session:

rails g authlogic:session user_session

these should work great

Uh, a lot of the above assumes no problem with rails 3.
The earlier stuff is a no…

On the last, on the above, it says authlogic:session - could not find.

Reason, no generator despite proper install of authlogic per previous
notes.

a lot of the above is useless for most people…

Paul Mr wrote:

Quinn Quinn wrote:

it worked for me. just follow the guide
(GitHub - binarylogic/authlogic_example: An example rails app using the Authlogic authentication library) but in your Gemfile
use:

gem ‘authlogic’, :git => ‘git://github.com/odorcicd/authlogic.git’,
:branch => ‘rails3’

and to generate a session:

rails g authlogic:session user_session

these should work great

Uh, a lot of the above assumes no problem with rails 3.
The earlier stuff is a no…

On the last, on the above, it says authlogic:session - could not find.

Reason, no generator despite proper install of authlogic per previous
notes.

a lot of the above is useless for most people…

I get the gem ‘authlogic’ to get past the ‘bundle install’…
but no matter what, cant rails g authlogic:session user_session.

Error is no generator authlogic:session

Rick R wrote:

On Sun, Sep 12, 2010 at 10:14 PM, Paul Mr [email protected] wrote:

thats what Im betting on.

On Sun, Sep 12, 2010 at 10:14 PM, Paul Mr [email protected] wrote:

Reason, no generator despite proper install of authlogic per previous
notes.

a lot of the above is useless for most people…

I get the gem ‘authlogic’ to get past the ‘bundle install’…
but no matter what, cant rails g authlogic:session user_session.

Error is no generator authlogic:session

Just do what Conrad said and manually create the files. I’m a newb and
I managed it:) I just copied and pasted the typical classes needed
(user_sessions_controller, users_controller, etc.) that are shown in
many of the examples online (like this one
GitHub - trevmex/authlogic_rails3_example: This is an example application demonstrating Authlogic running on Rails 3. )