How to change the default rails error div “field_with_errors”

前端 未结 6 1067
名媛妹妹
名媛妹妹 2020-12-13 08:12

I\'m using sorcery for authentication along with twitter bootstrap.

I\'d like to style my error messages on my signup form in the style of twitter\'s bootstrap by ch

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-13 08:24

    From the link above, if you put the following inside class Application < Rails::Application of config/application.rb

    config.action_view.field_error_proc = Proc.new { |html_tag, instance| 
      "
    #{html_tag}
    ".html_safe }

    Your input tags will have a red marker around them whenever validation fails

提交回复
热议问题