Cross Reference: action.rb
xref
: /
ontohub
/
app
/
models
/
action.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
action.rb revision 7a98c59af385a5f97431f644a495f95ae5b9c9d2
class
Action
<
ActiveRecord
::
Base
belongs_to
:
resource
,
polymorphic
:
true
attr_accessible
:
initial_eta
, :
resource
def
eta
(
time
=
Time.now
)
diff
=
(
created_at
+
initial_eta
)
-
time
[
diff
,
0
].
max
end
def
status
if
resource.nil
?
'waiting'
elsif
resource.respond
_to
?
(:
state
)
resource.state
elsif
resource.respond
_to
?
(:
status
)
resource.status
else
raise
NoMethodError
,
"resource does know neither state nor status."
end
end
end