【发布时间】:2014-06-18 06:12:38
【问题描述】:
我的仓库如下所示: https://github.com/Gtar69/artstore_hw2
错误信息: /Users/Gtar/project2/artstore-store-v1/app/models/order.rb:23:语法错误,意外的输入结束,期待keyword_end
Extracted source (around line #22):
def checkout
#if !current_user
@order = current_user.orders.build
@info = @order.build_info
#else
# redirect_to carts_path
Rails.root: /Users/Gtar/project2/artstore-store-v1
应用程序跟踪 |框架跟踪 |全跟踪 app/controllers/carts_controller.rb:22:in `checkout' 请求
我遇到了一个网页不能引用user.orders的问题。我很确定代码中的 current_user 可以正常工作,并且 model/user.rb 和 model/order.rb 中的声明使 has_one 关联良好。
我在项目中的逻辑是 在 carts/index.html 中使用 carts_controller.rb 上定义的 checkout 来呈现支付信息表单。对于结帐功能,它使用 current_user.orders 来 在 current_user.orders 中建立一个新的订单集合。
但是,current_user.orders 似乎没有退出(也在 Rails 委员会中)!需要吃药解决问题~~~谢谢!!!
【问题讨论】:
-
你的 current_user 方法是怎么说的?
-
好的,知道了。您在
order模型中缺少end语句。
标签: ruby-on-rails ruby ruby-on-rails-3