`
mimosa
  • 浏览: 4971 次
  • 性别: Icon_minigender_1
  • 来自: 上海
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论
文章列表
引用app/controllers/application_controller.rb # 表單驗證錯誤 ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| message = case html_tag when /<(label)/ %(<div class="error">#{html_tag}</div>).html_safe when /<(input|textarea|select)/ if inst ...
引用app/controllers/application_controller.rb # 禁止使用保留字 rescue_from FriendlyId::ReservedError do |exception| logger.info "错误提交保留字:#{exception.message}" if exception flash[:error] = I18n.t('friendly_id.error_messages.reserved') redirect_to :back end
# 獲取父节点群 # params = {'other' => 'other','person_id' => 'admin', 'blog_id' => '3', 'post_id' => '1'} def get_parent return @parent if defined?(@parent) parent = {} params.each do |name, value| if name =~ /(.+)_id$/ if parent.empty? paren ...
引用lib/mongoid/counter_cache.rb # encoding: utf-8 module Mongoid #:nodoc: # This module handles the behaviour for Counter Cache. module CounterCache #:nodoc: extend ActiveSupport::Concern included do set_callback :create, :after, :increment_counter set_callback :destroy, ...
Global site tag (gtag.js) - Google Analytics