2012-06-06 5 views

답변

6

내가했다 접근 방식은 초기화 파일과 같은 코드를 추가했다 :

그런

/path/to/your/application/config/initializers/auto_html.rb 당신은 할 수 다음과 같이 작성하십시오 :

AutoHtml.add_filter(:change_colours).with({}) do |text, options| 
    text.gsub("#FF0000", "#00FF00") 
end 

auto_html(input) { change_colours } 모델에 전화하십시오. 빈 해시는 필터로 전달할 수있는 모든 옵션을 취합니다.