我正在尝试使用标签链接其中一个按钮(按钮来自 Twitter 引导程序),即 a 标签的类等于按钮,然后 href 是它应该重定向到的链接(没有代码,因为它没有正确显示)。
这行代码存在的文件在app/views/candidates/show,但是我想把它链接到app/views/donations/index.html.erb。我不断收到路由错误,不知道为什么(我还为捐赠和候选人设置了控制器,并在候选人和捐赠之间建立了模型关联,即候选人有很多捐赠,并通过donation_id链接它们。不知道还有什么我需要这样做才能使路由正常工作)。
这是打印出来的 rake 路线:
candidates_show GET /candidates/show(.:format) candidates#show
candidates_new GET /candidates/new(.:format) candidates#new
donations_index GET /donations/index(.:format) donations#index
home_index GET /home/index(.:format) home#index
import_candidates POST /candidates/import(.:format) candidates#import
candidates GET /candidates(.:format) candidates#index
POST /candidates(.:format) candidates#create
new_candidate GET /candidates/new(.:format) candidates#new
edit_candidate GET /candidates/:id/edit(.:format) candidates#edit
candidate GET /candidates/:id(.:format) candidates#show
PUT /candidates/:id(.:format) candidates#update
DELETE /candidates/:id(.:format) candidates#destroy
root / home#index