user1461715
user1461715

Reputation: 11

authlogic not working with rails 2.3

I am using authlogic gem. I was following the railscasts video for help http://railscasts.com/episodes/160-authlogic?autoplay=true I run into a problem when I do the sudo rake gems:install it gives me an error :

at /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rdoctask.rb

rake aborted!

(eval):1:in `define_callbacks': compile error

(eval):1: syntax error, unexpected tEQ, expecting '\n' or ';'
...  def self.terminatorresult == false(*methods, &block)      ...

                          ^

I tried uninstalling the rake gem and installing it again. I tried going to a lower version of rake and that also did not work.

What should I do here?

Do I need to edit the rake gem and include this in there..

base.define_callbacks :persist, :terminator => "result == true"

I found the above on http://pastebin.com/Q3eL53ZJ

If yes then how? If there is a better solution then please guide me.

Upvotes: 0

Views: 282

Answers (2)

Don Law
Don Law

Reputation: 1329

To fix this, I first removed all my authlogic gems:

  gem uninstall authlogic

I'm using rails 2.3.15 because that is what hostgator is using. The authlogic version that matches is 2.1.3, so I added this to config/environment.rb:

config.gem "authlogic", :version => '2.1.3'

Then did rake gems:install. Afterwards, a script/generate controller user_sessions command actually generated the user_session.rb in model.

Upvotes: 0

Sean Kibler
Sean Kibler

Reputation: 11

Make sure you are not trying to use the master branch with Rails 2.x it is only compatible with Rails 3.x.

Use the rails2 branch if you are on Rails 2.x, I actually just used an older version since I wanted to just maintain some legacy site without too much concern about upgrading gems. I used version 2.1.5 and it worked fine.

Good luck!

Upvotes: 1

Related Questions