Class: Version
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Version
- Includes:
- Property::Base, Property::Serialization::JSON, RubyLess, Versions::Auto, Versions::Destroy, Zena::Use::Dates::ModelMethods, Zena::Use::Workflow::VersionMethods
- Defined in:
- app/models/node.rb,
app/models/version.rb
Overview
This is an ugly fix related to the circular dependency between Node and Version
Direct Known Subclasses
Instance Attribute Summary
Attributes included from Zena::Use::Workflow::VersionMethods
#backup, #no_clone_on_change, #status_set, #stored_workflow
Instance Method Summary collapse
- #author ⇒ Object
-
#cloned ⇒ Object
node_with_secure is defined in node.rb.
- #mark_for_destruction ⇒ Object
- #node_with_secure ⇒ Object
- #previous_number ⇒ Object
Methods included from Zena::Use::Workflow::VersionMethods
#clone_on_change?, #edited?, included, #should_clone?, #status=, #status_set?
Methods included from Zena::Use::Dates::ModelMethods
Methods included from Zena::Use::Dates::Common
Instance Method Details
#author ⇒ Object
56 57 58 |
# File 'app/models/version.rb', line 56 def user.node end |
#cloned ⇒ Object
node_with_secure is defined in node.rb. It is an ugly fix related to the circular dependency between Node and Version
42 43 44 |
# File 'app/models/version.rb', line 42 def cloned set_defaults end |
#mark_for_destruction ⇒ Object
60 61 62 63 |
# File 'app/models/version.rb', line 60 def mark_for_destruction super self.status = -1 end |
#node_with_secure ⇒ Object
1969 1970 1971 1972 1973 1974 1975 1976 |
# File 'app/models/node.rb', line 1969 def node_with_secure @node ||= begin if n = secure(Node) { node_without_secure } n.version = self end n end end |
#previous_number ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'app/models/version.rb', line 47 def previous_number if node_id = self[:node_id] last_record = self.connection.select_one("SELECT number FROM #{self.class.table_name} WHERE node_id = '#{node[:id]}' ORDER BY number DESC LIMIT 1") (last_record || {})['number'].to_i else nil end end |