Forum: Ruby on Rails Authlogic Rails 3

Posted by straightflush@gmail.com (Guest)
on 2010-02-19 04:17
(Received via mailing list)
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 ?
Posted by Conrad Taylor (conradwt)
on 2010-02-19 04:26
(Received via mailing list)
On Thu, Feb 18, 2010 at 7:16 PM, straightflush@gmail.com <
straightflush@gmail.com> 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/<command> 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
Posted by Conrad Taylor (conradwt)
on 2010-02-19 04:31
(Received via mailing list)
On Thu, Feb 18, 2010 at 7:24 PM, Conrad Taylor <conradwt@gmail.com> 
wrote:

> Rails 3 doesn't use script/<command> 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
Posted by straightflush@gmail.com (Guest)
on 2010-02-19 05:03
(Received via mailing list)
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)'
Posted by Brian Pokosh (Guest)
on 2010-02-19 05:11
(Received via mailing list)
Just skip to bundle install

On Feb 18, 11:02 pm, "straightfl...@gmail.com"
Posted by straightflush@gmail.com (Guest)
on 2010-02-19 05:17
(Received via mailing list)
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.
Posted by Brian Pokosh (Guest)
on 2010-02-19 07:56
(Received via mailing list)
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, "straightfl...@gmail.com"
Posted by RaW (Guest)
on 2010-02-19 10:09
(Received via mailing list)
I think
$ script/generate
has been replaced with
$ r g
in Rails3

Am I right?
Posted by Conrad Taylor (conradwt)
on 2010-02-19 14:00
(Received via mailing list)
On Fri, Feb 19, 2010 at 1:08 AM, RaW <rafal@wrzochol.net> 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
Posted by straightflush@gmail.com (Guest)
on 2010-02-19 21:44
(Received via mailing list)
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?
Posted by Conrad Taylor (conradwt)
on 2010-02-19 23:38
(Received via mailing list)
On Fri, Feb 19, 2010 at 12:42 PM, straightflush@gmail.com <
straightflush@gmail.com> 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
Posted by Conrad Taylor (conradwt)
on 2010-02-19 23:40
(Received via mailing list)
On Fri, Feb 19, 2010 at 2:37 PM, Conrad Taylor <conradwt@gmail.com> 
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
Posted by straightflush@gmail.com (Guest)
on 2010-02-21 06:34
(Received via mailing list)
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.
Posted by Ken Foust (roamy)
on 2010-03-24 18:06
Conrad Taylor wrote:
> On Fri, Feb 19, 2010 at 1:08 AM, RaW <rafal@wrzochol.net> 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??
Posted by Conrad Taylor (conradwt)
on 2010-03-24 20:10
(Received via mailing list)
Sent from my iPhone

On Mar 24, 2010, at 10:06 AM, Ken Foust <lists@ruby-forum.com> 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
Posted by Quinn Quinn (chaffeqa)
on 2010-06-04 14:00
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
Posted by Paul Mr (tulsaboyw)
on 2010-09-13 02:25
Quinn Quinn wrote:
> 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


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...
Posted by Paul Mr (tulsaboyw)
on 2010-09-13 04:14
Paul Mr wrote:
> Quinn Quinn wrote:
>> 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
> 
> 
> 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
Posted by Rick R (Guest)
on 2010-09-13 04:23
(Received via mailing list)
On Sun, Sep 12, 2010 at 10:14 PM, Paul Mr <lists@ruby-forum.com> 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
http://github.com/trevmex/authlogic_rails3_example )
Posted by Paul Mr (tulsaboyw)
on 2010-09-13 04:38
Rick R wrote:
> On Sun, Sep 12, 2010 at 10:14 PM, Paul Mr <lists@ruby-forum.com> wrote:

thats what Im betting on.
Posted by Paul Mr (tulsaboyw)
on 2010-09-13 19:48
Paul Mr wrote:
> Rick R wrote:
>> On Sun, Sep 12, 2010 at 10:14 PM, Paul Mr <lists@ruby-forum.com> wrote:
> 
> thats what Im betting on.

Pretty much.. that one creates all the models/scaffolds/controllers the 
usual way...not even caring about Authlogic::Session::Base

though I assume possibly, manually editing the one item to reflect that 
instead of activerecord (or whatever it was).
Posted by Jeffrey L. Taylor (Guest)
on 2010-09-14 06:07
(Received via mailing list)
Quoting Paul Mr <lists@ruby-forum.com>:
> instead of activerecord (or whatever it was).
> -- 

IIRC, AuthLogic works w/ Rails 3, but doesn't have the new generator
structure.  Generate it in Rail 2.x and copy the files over.

Jeffrey
Posted by Up 4. (up_4)
on 2010-12-23 13:55
I think you should add the following line in your gem file:

gem "rails3-generators"

run "bundle install" or "bundle update" and then run "rails g 
authlogic:session UserSession" to create UserSession class

It is required to add your required generators (see
http://www.dixis.com/?p=352 for more information)

UP4B LLC
http://up4b.com
Posted by Daniel Sanchez (dmsanchez80)
on 2012-11-20 15:37
Up 4. wrote in post #970286:
> I think you should add the following line in your gem file:
>
> gem "rails3-generators"
>
> run "bundle install" or "bundle update" and then run "rails g
> authlogic:session UserSession" to create UserSession class
>
> It is required to add your required generators (see
> http://www.dixis.com/?p=352 for more information)
>
> UP4B LLC
> http://up4b.com

GENIO UP_4!!!!!!.... LO QUE FALTABA ERA INDICARLE A RAILS QUE USARA EL 
GENERATOR INTERNO DE LA GEMA authlogic.!!.. así funciona joya!!..
GRACIAS!!
Posted by Raj Kiran Bhogaraju (rajkiran55)
on 2012-12-27 08:39
rails generate model user_session

This works fine for generating sessions in Authlogic for Rails 3 and 
above versions.
Posted by Denis Rogov (glafir)
on 2013-03-27 11:02
Please, Help Me!
I installed "Ruby On Rails -v 3.2.13" on Ubuntun 12.04 amd64 winth rvm.
Then I tried to install 'authlogic' from 
https://github.com/binarylogic/authlogic

When I am trying generate model User_session, I get this error:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
root@glafir-Maximus-Formula:/home/glafir/RoR/ic# rails generate session 
user_session
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.13/lib/active_record/dynamic_matchers.rb:55:in 
`method_missing': undefined local variable or method 
`inheritable_attributes' for ActiveRecord::Base:Class (NameError)
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/authlogic-85b2a6b3e999/lib/authlogic/acts_as_authentic/base.rb:64:in 
`acts_as_authentic_modules'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/authlogic-85b2a6b3e999/lib/authlogic/acts_as_authentic/base.rb:44:in 
`add_acts_as_authentic_module'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/authlogic-85b2a6b3e999/lib/authlogic/acts_as_authentic/email.rb:11:in 
`block in included'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/authlogic-85b2a6b3e999/lib/authlogic/acts_as_authentic/email.rb:9:in 
`class_eval'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/authlogic-85b2a6b3e999/lib/authlogic/acts_as_authentic/email.rb:9:in 
`included'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/authlogic-85b2a6b3e999/lib/authlogic/acts_as_authentic/base.rb:96:in 
`include'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/authlogic-85b2a6b3e999/lib/authlogic/acts_as_authentic/base.rb:96:in 
`<top (required)>'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in 
`require'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in 
`block in require'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in 
`load_dependency'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in 
`require'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/authlogic-85b2a6b3e999/lib/authlogic.rb:59:in 
`block in <top (required)>'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/authlogic-85b2a6b3e999/lib/authlogic.rb:6:in 
`each'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/authlogic-85b2a6b3e999/lib/authlogic.rb:6:in 
`<top (required)>'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in 
`require'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in 
`block (2 levels) in require'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in 
`each'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in 
`block in require'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in 
`each'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in 
`require'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler.rb:132:in 
`require'
  from /home/glafir/RoR/ic/config/application.rb:5:in `<top (required)>'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.13/lib/rails/commands.rb:24:in 
`require'
  from 
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.13/lib/rails/commands.rb:24:in 
`<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

gem list
+++++++++++++++++++
*** LOCAL GEMS ***

actionmailer (3.2.13, 3.2.12, 3.2.8)
actionpack (3.2.13, 3.2.12, 3.2.8)
activemodel (3.2.13, 3.2.12, 3.2.8)
activerecord (3.2.13, 3.2.12, 3.2.8)
activeresource (3.2.13, 3.2.12, 3.2.8)
activesupport (3.2.13, 3.2.12, 3.2.8)
arel (3.0.2)
authlogic (3.2.0)
bcrypt-ruby (3.0.1)
builder (3.0.4, 3.0.3)
bundler (1.3.4)
ckeditor (4.0.2, 3.7.3)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.2, 1.6.1, 1.3.3)
diff-lcs (1.2.1, 1.1.3)
erb2haml (0.1.4, 0.1.2)
erubis (2.7.0)
execjs (1.4.0)
gravatar_image_tag (1.1.3)
haml (4.0.1, 3.1.7)
haml-rails (0.4, 0.3.5)
hike (1.2.1)
hpricot (0.8.6)
i18n (0.6.4, 0.6.1)
journey (1.0.4)
jquery-rails (2.2.1, 2.1.2)
json (1.7.7, 1.7.5)
lazybox (0.2.5, 0.2.1)
mail (2.5.3, 2.4.4)
mime-types (1.21, 1.19)
mini_magick (3.5.0, 3.4)
mousetrap-rails (0.0.9, 0.0.5)
multi_json (1.7.2, 1.7.0, 1.3.6)
mysql (2.9.1, 2.8.1)
mysql2 (0.3.11)
nokogiri (1.5.9, 1.5.5)
orm_adapter (0.4.0)
polyglot (0.3.3)
rack (1.4.5, 1.4.1)
rack-cache (1.2)
rack-ssl (1.3.3, 1.3.2)
rack-test (0.6.2, 0.6.1)
rails (3.2.13, 3.2.12, 3.2.8)
rails3-generators (1.0.0)
railties (3.2.13, 3.2.12, 3.2.8)
rake (10.0.4, 10.0.3, 0.9.2.2)
rdoc (3.12.2, 3.12)
rspec (2.11.0)
rspec-core (2.13.1, 2.11.1)
rspec-expectations (2.13.0, 2.11.3)
rspec-mocks (2.13.0, 2.11.3)
rspec-rails (2.13.0, 2.11.0)
ruby_parser (3.1.2, 2.3.1)
rubygems-bundler (1.1.1)
russian (0.6.0)
rvm (1.11.3.6)
sass (3.2.7, 3.2.1)
sass-rails (3.2.6, 3.2.5)
sexp_processor (4.2.0, 3.2.0)
sprockets (2.2.2, 2.1.3)
sqlite3 (1.3.7, 1.3.6)
stamp (0.5.0, 0.2.0)
subexec (0.2.2)
thor (0.18.0, 0.17.0, 0.16.0)
tilt (1.3.6, 1.3.5, 1.3.3)
treetop (1.4.12, 1.4.10)
tzinfo (0.3.37, 0.3.33)
uglifier (1.3.0)
webrat (0.7.3)
will_paginate (3.0.4, 3.0.3)
++++++++++++++++++++++++++++++++++

Ruby -v
++++++++++++++
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
+++++++++++++++

Where I made a mistake? Help me, please!
Posted by Denis Rogov (glafir)
on 2013-03-27 11:14
I am sorry(((
This Plugin work for RoR 3.0, but It is not work for RoR 3.2(((

http://railsplugins.org/plugins/56-authlogic?crite...

Nothing can be done?
Posted by greatghoul (Guest)
on 2013-03-27 11:18
(Received via mailing list)
Session will lost sometimes with no reason even if you create it 
successful.
So, go and use some other gems instead.

On Wed, Mar 27, 2013 at 6:14 PM, Denis Rogov <lists@ruby-forum.com> 
wrote:

> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


--
 *greatghoul <http://www.g2w.me> - Ask and Learn!*
Posted by Colin Law (Guest)
on 2013-03-27 11:21
(Received via mailing list)
On 27 March 2013 10:14, Denis Rogov <lists@ruby-forum.com> wrote:
> I am sorry(((
> This Plugin work for RoR 3.0, but It is not work for RoR 3.2(((
> Nothing can be done?

I think Devise is probably a better solution.

Colin
Posted by Denis Rogov (glafir)
on 2013-03-27 11:23
Thank You!
I shall try to use 'devise'.
Posted by Jeffrey Jones (Guest)
on 2013-03-27 12:23
(Received via mailing list)
devise or sorcery, both good gems with different approaches.

devise has many more features
sorcery is more lightweight.

Worth investigating both.
Posted by Denis Rogov (glafir)
on 2013-03-27 12:24
what is sorcery?
Posted by Colin Law (Guest)
on 2013-03-27 12:50
(Received via mailing list)
On 27 March 2013 11:24, Denis Rogov <lists@ruby-forum.com> wrote:
> what is sorcery?

You could google for
rails sorcery
to find out.

Colin
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.