bkn*_*les 15 edit-in-place ruby-on-rails-3
有没有人知道使用带有best_in_place gem的嵌套资源是否可能(如果是这样,语法是什么)?
我的routes.rb看起来像这样
resources :users do
resources :goals
end
Run Code Online (Sandbox Code Playgroud)
我想编辑:description目标的字段,但我的视图中的代码
<%= best_in_place [@user, @goal], :description %>
Run Code Online (Sandbox Code Playgroud)
给出NoMethodError说
undefined method `description' for #<Array:0x20e0d28>
Run Code Online (Sandbox Code Playgroud)
运用
<%= best_in_place @goal, :description %>
Run Code Online (Sandbox Code Playgroud)
给我一个未定义的方法错误,因为没有 goal_path
我可以让gem为@user(非嵌套资源)字段工作而不会出现问题.
我正在运行Rails 3.1.1,Ruby 1.9.2,best_in_place 1.0.4
bkn*_*les 20
我想到了.
我需要path像这样设置调用中的选项
<%= best_in_place @goal, :description, :path => user_goal_path %>
Run Code Online (Sandbox Code Playgroud)
它现在像一个冠军!
Vin*_*ils 10
将路径和对象添加到路径:
<%= best_in_place @goal, :description, :path => user_goal_path(@user,@goal) %>
Run Code Online (Sandbox Code Playgroud)
不知怎的,bknoles的简单路径解决方案对我不起作用.
| 归档时间: |
|
| 查看次数: |
4772 次 |
| 最近记录: |