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 ?

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

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

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

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 don't think the generator works in rails3. Just create the file yourself:

class UserSession < Authlogic::Session::Base end

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

Am I right?

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

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?

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](http://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

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](http://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

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.

Conrad Taylor wrote:

Conrad Taylor 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??

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 (http://github.com/binarylogic/authlogic_example) 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

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 http://github.com/trevmex/authlogic_rails3_example )

Rick R wrote: