Class | Document |
In: |
app/models/document.rb
|
Parent: | ActiveRecord::Base |
関連文書のモデル。
番号を返す用いるメソッド名を返す。
# File app/models/document.rb, line 73 73: def content_for(x) 74: method_for(x, "content") 75: end
複製機能のためのコピーを返す。
# File app/models/document.rb, line 78 78: def copy 79: copied = self.class.new 80: copied.attributes = attributes 81: copied.relatable_id = nil 82: return copied 83: end
文書の fragment のためのオプションを返す。
# File app/models/document.rb, line 58 58: def fragment_options_for(x) 59: value_for(x) {|key| {:product => product(key), :document => __send__(key)}} 60: end
名前を返すメソッド名を返す。
# File app/models/document.rb, line 63 63: def name_for(x) 64: method_for(x, "name") 65: end
番号を返すメソッド名を返す。
# File app/models/document.rb, line 68 68: def number_for(x) 69: method_for(x, "number") 70: end
key に対応する機能を返す。
# File app/models/document.rb, line 39 39: def product(key) 40: product = __send__("#{key}_product") 41: if product && product.visible? && product.document? 42: return product 43: end 44: raise ArgumentError, "product #{product.inspect} is not tuned for document" 45: end
key に対応する機能の ID を返す。
# File app/models/document.rb, line 48 48: def product_id(key) 49: product(key).id 50: end