acts_as_authenticated error

I tried to use acts_as_authenticated on my site but I was getting some errors. I went to techno-weenie and found that they depreciated that for restful_authentication instead.

Ok, so I follow the instructions as laid out here:

Also in the book I purchased "rails cookbook"

Well I place in one of my controllers before_filter :login_required and I get this error: "undefined method `authenticate_with_http_basic' for #<UsersAddressController:0x2aaaac214b30> "

Now I have been reading as much as I can online but I am not getting anywhere. I think it may just be that I do not fully understand the concept behind how this plugin works. When I was on the rails irc the other day I was told that my situation was hard to analyze because I did not provide any code.

What code exactly? I assume that I am able to place in before_filter :login_required on any given controller and that would be the end of it minus creating accounts. Am I mis-understood? Also, when I use this line: script/generate authenticated user sessions --include-activation --stateful I am not able to pull up any basic login/out pages as the templates are missing?

I would not use basic templates in production to begin with but my point here is I cannot seem to get the basics working and I think I am just missing the point of this plugin.

Does anyone have any insight?

What version of Rails are you using? authenticate_with_http_basic was introduced in Rails 2.0.



Robin Fisher wrote:

"undefined method `authenticate_with_http_basic' for #<UsersAddressController:0x2aaaac214b30> "

What version of Rails are you using? authenticate_with_http_basic was introduced in Rails 2.0.



Thats a good question. Using gem list I see 2.0.2. Now there is a caveate with that I think..

First, I installed via Ubuntu's synaptic rails 1.4 prior to 2.0.2. I was trying to use acts_as_authenticated then and I quickly learned through google that I needed > 2.0. So I used gem install to get 2.0. - I believe synaptic package manager still believes I have 1.4 installed (maybe I should remove that?)

Once that was installed I shut-down/start-up the rails server. I also noticed that in my environment.rb that RAILS_GEM_VERSION was still 1.4. So I simply changed that number to reflect what was in gem list.

Is that an issue?

I was thinking I might want to backup my controllers/views/models/migrates/etc and just rebuild the application? I do not see why it should come to that though so I am holding back from that option.

Is there a way that my rails app, which was installed in 1.4, is still using 1.4 even though gem list says 2.0.2?

You can force rails to use a specific version by editing your environment.rb file. You need to set the RAILS_GEM_VERSION to 2.0.2. It is probably at 1.4 if your app was created before the update.