Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing template user_sessions/create.erb in view path app/views #3

Open
taddgiles opened this issue May 29, 2009 · 12 comments
Open

Missing template user_sessions/create.erb in view path app/views #3

taddgiles opened this issue May 29, 2009 · 12 comments

Comments

@taddgiles
Copy link

authlogic v2.0.13 and authlogic-oid v1.0.4

When I submit an invalid open id to a new session ("goodopenid.com" in my case) I get the following error:

Missing template user_sessions/create.erb in view path app/views

Here's my user_sessions_controller create method (copied from examples)

def create
@user_session = UserSession.new(params[:user_session])
# We are saving with a block to accomodate for OpenID authentication
# If you are not using OpenID you can save without a block:
#
# if @user_session.save
# # ... successful login
# else
# # ... unsuccessful login
# end
@user_session.save do |result|
if result
flash[:notice] = "Login successful!"
redirect_back_or_default root_path
else
render :action => :new
end
end
end

For some reason its attempting to render "create" rather than rendering "new" with errors.

Incidentally, I see the same problem in the sample app here:

http://authlogicexample.binarylogic.com/

There, when I use "goodopenid.com" I get a crash.

Ideas?

@Bluejade
Copy link

Bluejade commented Jul 9, 2009

This error appeared in a recent update of authlogic_openid. With version 1.0.4, all of my tests pass. With the current version, several things break, including the problem you mention here.

@taddgiles
Copy link
Author

so your tests pass with authlogic_openid 1.0.4? And which version of authlogic are you using?

@Bluejade
Copy link

Bluejade commented Jul 9, 2009

I was using 2.0.14, but have now upgraded to 2.1.1. Both pass all my tests. When I upgrade authlogic_openid to the current version, I get errors and assertion failures. The errors are the same one you report above: missing user_sessions/create.html.erb template.

@dbarison
Copy link

same problem here, with lastest version.
authlogic 2.1.1 + authlogic-oid 1.0.4 all ok.

@taddgiles
Copy link
Author

yup, confirmed, authlogic 2.0.14 and authlogic-oid 1.0.4 pass for me too.

@sporkd
Copy link

sporkd commented Jul 14, 2009

I posted something to the google group a while back about a commit that was made almost a month ago... You guys might want to check if it's the same issue I was having.

http://groups.google.com/group/authlogic/browse_thread/thread/fdc8dad50e8cf267/203f774bad6faa46?lnk=gst&q=block#203f774bad6faa46

@dbarison
Copy link

yes this solution fix this problem, thnx sporkd.
now remains some problems with auto_register enabled.

@tfe
Copy link

tfe commented Jul 29, 2009

Is there any chance of this being fixed and released in the official gem? I cannot modify code as in sporkd's link since I don't have control over gems in my deployment environment (Heroku), but can only reference ones that are in the gem repositories.

@sporkd
Copy link

sporkd commented Jul 29, 2009

Does heroku only let you use the official gem? i.e. can you not build your own? http://gems.github.com

If this is not possible, I would post to the thread up on the google group, as I'm not sure if ben checks these issues very often.

@bmishkin
Copy link

bmishkin commented Aug 6, 2009

See line 71 of lib/authlogic-oid/session.rb . When using authlogic-oid, it clears out the block:

  def save(&block)
    block = nil if !openid_identifier.blank?
    super(&block)
  end

leaving us with no render at all, so the default create template gets loaded.

My fix is to move the render on fail outside the block in the controller, and condition it on the record saving:

render :action => "new" if @user_session.new_record? # workaround for render inside authlogic-oid

@davidsf
Copy link

davidsf commented Aug 10, 2009

bmishkin: Can you post your controller, please ? thx.

@omarkarim
Copy link

The following might be worth a try:

def create
@user_session = UserSession.new(params[:user_session])
@user_session.save do |result|
if result
flash[:notice] = "Successfully logged in."
redirect_to root_url
end
end
if !performed? # no render or redirect yet
render :action => 'new'
end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants