nbudin / devise_openid_authenticatable

OpenID authentication for Devise
MIT License
99 stars 32 forks source link

Documentation issue? #11

Closed mem closed 12 years ago

mem commented 13 years ago

Hi,

I'm trying to create an example application using Rails 3.1 and only openid_authenticatable, without database_authenticable. The user model looks like this:

class User < ActiveRecord::Base
  devise :openid_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable
  attr_accessible :email, :remember_me
end

The migration looks like this:

class DeviseCreateUsers < ActiveRecord::Migration
  def self.up
    create_table(:users) do |t|
      t.openid_authenticatable
      t.recoverable
      t.rememberable
      t.trackable
      t.string :email
      t.timestamps
    end

    add_index :users, :email,                :unique => true
  end

  def self.down
    drop_table :users
  end
end

If I go to http://0.0.0.0:3000/users/sign_in

It responds with:

NoMethodError in Devise/sessions#new

Showing .../openid/app/views/devise/sessions/new.html.erb where line #3 raised:

undefined method `session_path' for #<#<Class:0x7fc03a0fe298>:0x7fc03a0f7498>
Extracted source (around line #3):

1: <h2>Sign in</h2>
2: 
3: <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
4:   <div><%= f.label :email %><br />
5:   <%= f.email_field :email %></div>
6: 

If I add database_authenticatable, the problem goes away, but I'm trying to do without that. My understanding, looking at the example app for Rails 2.x is that this is supported. Right?

I have:

nbudin commented 13 years ago

What you did should work fine, but I have a feeling that it broke with the Devise 1.3 or 1.4 update. I confess, I haven't actually tested this use case in awhile.

More investigation is needed; I'll try to get back to you as soon as I know more.

cure commented 12 years ago

I'm seeing the same thing with Devise 1.5.1 and devise_openid_authenticatable (1.0.0). Any updates on this?

cure commented 12 years ago

This problem does not exist if I downgrade Devise to 1.3.4.

nbudin commented 12 years ago

Hello everyone! Sorry about the delay in responding to this.

I've just released devise_openid_authenticatable 1.1.0, which drops support for Rails 2/Devise 1.1, and also supports newer versions of Devise without needing database_authenticatable in the mix. As a bonus, the code has become simpler.