devise_helper.rb is completely ignored

47 lượt xem
Chuyển tới thư đầu tiên chưa đọc

Val Kotlarov Hoffman

chưa đọc,
15:46:24 25 thg 6, 201425/6/14
đến plataforma...@googlegroups.com
Hi guys,

I'm with Rails 4, and I'm sure it worked before, but something happened and before I check when and what, maybe you can help.
The devise_helper.rb is completely ignored, I don't see the desired behavior and cannot even stop there with binding.pry to debug it.

Here's the contents, I'll be very thankful if you have anything to suggest.

module DeviseHelper          
  # Override the predefined Devise's method and
  # move the Devise errors to the flash[:errors]
  def devise_error_messages!   
    return if resource.errors.empty? || current_user_is_guest?
    errors = resource.errors.full_messages 
    errors.each do | error |
      flash.now[:errors] = error      
    end
  end 
end   

Lucas Mazza

chưa đọc,
11:11:09 26 thg 6, 201426/6/14
đến plataforma...@googlegroups.com
This helper is located at 'app/helpers/devise_helper.rb', right? I never tried this override before, but I wonder if it might be something related to the order of how each file - yours and the builtin devise_helper.rb - are loaded in the app. Can you reproduce it in a fresh app, push it to GitHub and post the repo URL here? I might be able to take a closer look on that.


--

---
You received this message because you are subscribed to the Google Groups "Devise" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Val Kotlarov Hoffman

chưa đọc,
02:32:53 27 thg 6, 201427/6/14
đến plataforma...@googlegroups.com
Hi Lucas,

Yes, the file is under app/helpers and it's devise_helper.rb. I created a sample project from scratch and reproduced the bug. Please take a look at it here https://github.com/valk/devise-helper-ignored

Thanks!
Trả lời tất cả
Trả lời tác giả
Chuyển tiếp
0 tin nhắn mới