Class: Block
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Block
show all
- Defined in:
- app/models/block.rb
Instance Method Summary
collapse
Instance Method Details
#clone ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'app/models/block.rb', line 29
def clone
cloned = super
cloned.translations = translations.clone unless translations.empty?
%w(page_col_ids category_ids).each do |method|
cloned.send("#{method}=",self.send(method))
end
return cloned
end
|
#link_with(page) ⇒ Object
46
47
48
49
|
# File 'app/models/block.rb', line 46
def link_with(page)
page.blocks << self
page.blocks.reset_positions
end
|
#linked_with?(page) ⇒ Boolean
42
43
44
|
# File 'app/models/block.rb', line 42
def linked_with?(page)
self.pages.include?(page)
end
|
#pages ⇒ Object
38
39
40
|
# File 'app/models/block.rb', line 38
def pages
self.page_cols.map(&:page)
end
|
#unlink_with(page) ⇒ Object
51
52
53
54
|
# File 'app/models/block.rb', line 51
def unlink_with(page)
page.blocks.delete self
page.blocks.reset_positions
end
|