Ell*_*iot 1 ruby ruby-on-rails ruby-on-rails-plugins ruby-on-rails-3
我一直在关注这篇文章中的第二个解决方案:在rails中使用相同型号的多对多关系?
使用插件Rails Admin(https://github.com/sferik/rails_admin)
使用下面的代码,特别是似乎打破了Rails管理员:
class PostConnection < ActiveRecord::Base
belongs_to :post_a, :class_name => :Post
belongs_to :post_b, :class_name => :Post
end
Run Code Online (Sandbox Code Playgroud)
对于我能做什么的任何想法?
更新:
这是所要求的错误:
NoMethodError in Rails_admin/main#index
Showing /Users/elliot/.rvm/gems/ruby-1.8.7-p299/bundler/gems/rails_admin-5713b1671e8c/app/views/rails_admin/main/index.html.erb where line #18 raised:
undefined method `match' for :Post:Symbol
Extracted source (around line #18):
15: <tbody>
16: <% @abstract_models.each do |abstract_model| %>
17: <tr class="<%= cycle 'odd', 'even' %>">
18: <td class="modelNameRow">
19: <%= link_to(RailsAdmin.config(abstract_model).list.label, rails_admin_list_path(:model_name => abstract_model.to_param), :class => "show") %>
20: </td>
21: <td>
Run Code Online (Sandbox Code Playgroud)
在模型的belongs_to语句中,尝试更改:class_name => :Post为:class_name => 'Post'(字符串与符号).我很确定这是错误消息的相关内容.
| 归档时间: |
|
| 查看次数: |
907 次 |
| 最近记录: |