Guest User

Untitled

a guest
Jul 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. ## Environment.rb
  2.  
  3.  
  4. Rails::Initializer.run do |config|
  5.  
  6. # ... code here ...
  7.  
  8. ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
  9. if html_tag =~ /<(input|label|textarea|select)/
  10. error_class = 'error'
  11. nodes = Hpricot(html_tag)
  12. nodes.each_child { |node| node[:class] = node.classes.push(error_class).join(' ') unless !node.elem? || node[:type] == 'hidden' || node.classes.include?(error_class) }
  13. nodes.to_html
  14. else
  15. html_tag
  16. end
  17. end
  18.  
  19. end
  20.  
  21. ## this throws an error as ActionView being an uninitialized constant when I run "rake db:migrate" on the console. What's up?
Add Comment
Please, Sign In to add comment