Devise error using rails 3.0.1 on sign_in action - ruby-on-rails

I'm developing a rails 3 app using rails 3.0.1 and I'd like to use devise for user auth, but when I login with a user email, I get this error:
RuntimeError in Devise/sessionsController#create
In order to use respond_with, first you need to declare the formats your controller responds to in the class level
I installed devise using Gemspec.

I have the same issue yesterday and today i up a ticket and they fix the problem. Make a bundle update to have the fix version.

Make sure this is the first entry in your routes file
devise_for :users
Consider upgrading to Rails 3.0.3

Related

Ruby on Rails Devise - Setup - Already Used?

Working through the setup for Devise.
Running
rails generate devise admin
since admin seems to be the user model setup in my app where I now what it to be SSO auth but I get
The name 'Admin' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative or use --skip-collision-check or --force to skip this check and run this generator again.
is it OK to force/ignore this? or ?

devise ActiveRecord::StatementInvalid in Devise::SessionsController#new error

I'm a new to rails so I'm still learning some concepts.
I installed the ruby gem devise to help with adding users/database etc..
I'm getting an error when I'm trying to access paths provided by devise.
The URL for my page is
https://rubypractice-minhaja.c9users.io
And for example if I try to access
https://rubypractice-minhaja.c9users.io//users/sign_in
I get the same error mentioned in my title I've tried for a long time to look up for a solution but I'm yet to find one.
I did check rails routes and all the routes are there so I'm not sure what the issue is.
https://github.com/minhajahmed1/event_platform
Above is the link to my github if that helps. I would really appreciate any help I get, thanks.
The line
$ rails generate devise MODEL
Was just an example, if you read the instructions you should have replaced "MODEL" with your model name "User"
$ rails generate devise User

How upgrade devise 2.1.2 to devise 3.2.2

I want to upgrade my current devise from 2.1.2 to 3.2.2
I added the secret_key to the initialiser so the rails server starts fine.
But when I try to login I can't. Examining the logs didn't make me any smarter.
I just get a 401 Unauthorized exception in the Rails log.
Can anybody give direction how to upgrade? Or how I could debug this a little bit better?
Maybe you should check your sign in field. if you follow devise guide (https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address), your sign in field should be "login", not "email"

Rails 3.0.9 + open_id_authentication

I'm using open_id_authentication gem to authenticate to google. In my sessions controller I call
authenticate_with_open_id(complete_identity_url, OPENID_OPTS) do |openid_result, identity_url, registration|
and it returns 401 status code Unauthenticated. But it should show google page in which I must confirm access.
I made example app: https://github.com/mbashirov/rails3-test, it only has code in sessions controller and routes set.
That code works perfectly on rails 2.3 app. There is error?
Thanks.
Solution.
In sessions controller add
class SessionsController < ApplicationController
include OpenIdAuthentication
In config/application.rb add
config.app_middleware.use OpenIdAuthentication
After this two steps all works fine.
If it works in 2.3 and then doesn't work in 3, it sounds like an error not of your own making.
Next steps:
1) Upgrade to latest 3.1 (or better 3.1.1) Rails
2) Contact the authors of the gem to see what their 3.1 support plans are. They may already be working on a solution that you can help test.
3) If you have the skills, it would be awesome for you to contribute back by solving the problem.
I suggest that you start with an Ether peek tool such as Fiddler or a Mac tool to see if your machine is sending out the same requests/getting the same responses when running 3.1.1 vs 2.3.
Then debug....

Any working tutorials for Authlogic?

I've been trying to build my first rails app and have gotten stuck on the issue of user authentication. I've found a number of tutorials for using various plug-ins to do this, but so far every single one of them is out-dated, and as a result, broken!
From what I've read, I think Authlogic may be the best fit for me, and I've tried two things:
1) Going through Railscast, episode #160 (which is a tutorial for setting it up)
2) Using Ryan B's nifty_authentication gem with the --authlogic tag
In both cases, I get the following error as soon as I try to do anything with a user:
undefined local variable or method `acts_as_authentic' for #
I believe this is from the User model:
class User < ActiveRecord::Base
acts_as_authentic
end
I'm sure I've installed the authlogic gem, and I've added
config.gem "authlogic"
to my environment.rb
Any ideas about what's wrong? Anybody know of a complete and up to date tutorial for adding user authentication?
Edit:
I'm running Ruby v. 1.8.6 and rails v. 2.3.5
There is one thing that Ryan Bates in the RailsCasts episode doesn't talk about is about creating sessions table in your database. Type rake db:sessions:create in the console and run the migration rake db:migrate. Also like ghoppe says run rake gems:install after installing the gem. That is a requisite.
Here's an example app with a step-by-step guide - it's from last year but should still be mostly if not entirely accurate:
authlogic_example
Since you added that line to your environment.rb, have you tried rake gems:install to ensure the gem is installed and working correctly?
Also, what version of Ruby? What version of Rails? Have you tried running gem environment and gem list to make sure they're installed and running from the right place?
Another option is to use authlogic as a plugin, with:
script/plugin install git://github.com/binarylogic/authlogic.git
It also helps to look at a projects that uses authlogic as authentication module, like the fat_free_crm project, have a look at user.rb there
Last but not least, there is an active mailing list:
authlogic mailing list
Becoming popular is also the devise gem. Here you can add authentication with script/generate devise and you will have some views for login as well.
I forked that authlogic_example and added activity_tracker, authlogic, paperclip for user profile images, declarative_authorization, and user to user messages.
http://github.com/jspooner/authlogic_cucumber_rspec_example

Resources