我在文件中有link_to
一行代码html.erb
:
<%= link_to "no thanks" %>
我想点击这个链接来触发:reject
我在这个“treating.rb”模型文件中设置的状态方法:
class Treating < ActiveRecord::Base
attr_accessible :intro, :proposed_date, :proposed_location, :requestee_id, :state
state_machine :state, :initial => :pending do
event :reject do
transition [:pending] => :rejected
end
event :reply do
transition [:pending, :rejected] => :replied
end
event :archive do
transition [:rejected] => :archived
end
end
...
end
我在我link_to
的代码行中添加了什么来获得它所指的“治疗”,以使其状态从“待定”变为“拒绝”?我已经尝试过action =>
,method =>
但没有成功。