我刚刚开始使用Ruby on Rails编程,我遇到了问题。
这是我的控制器
def new_card
@card = Card.new
end
def create_card
@card = Card.new(params[:card])
if @card.save
flash[:notice] = "Card created"
redirect_to :action => "Card_information", :id => @card.id
else
render new_card_path
end
end
def card_information
@card = Card.find(params[:id])
end
这些是我的观看文件:
(create_card)
= form_for @card, :url => create_card_path do |f|
.row
.span3
= f.label "Card name"
= f.text_field :title
%br/
.row
.span3
= f.submit "Submit", :class => "btn btn-primary"
card_information
.row
.span12
%h3
= @card.title
最后我的路线:
match 'card_information/:id' => 'home#card_information'
match 'create_card' => 'home#create_card'
当我尝试启动创建卡页面时,我显示错误页面错误页面