Cross Reference: action.rb
xref
: /
ontohub
/
app
/
models
/
action.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
action.rb revision 3da1771ccd411609156bf2721537c6a8e41050d4
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.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