Merge 06c60ef095 into 18bb1bd237
This commit is contained in:
commit
5abd4abddd
2 changed files with 29 additions and 24 deletions
|
|
@ -300,4 +300,17 @@ module ApplicationHelper
|
|||
def unread_notifications(user)
|
||||
Comment.accessible_by(current_ability).find_since_last_login(user)
|
||||
end
|
||||
|
||||
def create_user_if_not_signed_in
|
||||
unless current_user
|
||||
@user = User.new(user_params)
|
||||
if @user.save
|
||||
sign_in(@user)
|
||||
else
|
||||
flash[:error] = "Could not save user: #{@user.errors.full_messages.join(', ')}"
|
||||
render action: 'new'
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue