Class Document
In: app/models/document.rb
Parent: ActiveRecord::Base

関連文書のモデル。

Methods

Public Instance methods

番号を返す用いるメソッド名を返す。

[Source]

    # File app/models/document.rb, line 73
73:   def content_for(x)
74:     method_for(x, "content")
75:   end

複製機能のためのコピーを返す。

[Source]

    # 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 のためのオプションを返す。

[Source]

    # 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

名前を返すメソッド名を返す。

[Source]

    # File app/models/document.rb, line 63
63:   def name_for(x)
64:     method_for(x, "name")
65:   end

番号を返すメソッド名を返す。

[Source]

    # File app/models/document.rb, line 68
68:   def number_for(x)
69:     method_for(x, "number")
70:   end

key に対応する機能を返す。

[Source]

    # 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 を返す。

[Source]

    # File app/models/document.rb, line 48
48:   def product_id(key)
49:     product(key).id
50:   end

文書の URL のためのオプションを返す。

[Source]

    # File app/models/document.rb, line 53
53:   def url_options_for(x)
54:     value_for(x) {|key| {:product_id => product_id(key), :id => __send__("#{key}_id")}}
55:   end

[Validate]