Ruby on rails RailsAdmin NoMethodError在RailsAdmin::Main#delete中
我有订购的型号:Ruby on rails RailsAdmin NoMethodError在RailsAdmin::Main#delete中,ruby-on-rails,ruby,rails-admin,Ruby On Rails,Ruby,Rails Admin,我有订购的型号: class Order < ActiveRecord::Base has_one :shipping_address has_and_belongs_to_many :books validates :first_name, :surename, :email, :street1, :country, :zipcode, presence: true validates_format_of :email, :with => /\A([^@\s]+)
class Order < ActiveRecord::Base
has_one :shipping_address
has_and_belongs_to_many :books
validates :first_name, :surename, :email, :street1, :country, :zipcode, presence: true
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
validates :zipcode, numericality: true
accepts_nested_attributes_for :shipping_address
end
您是否在代码中的任何地方定义了“orders\u books”方法?如果是的话,请你把它添加到你的问题中。如果没有,那么问题的根本原因就是,您正在调用“orders\u books”方法,但它尚未定义
考虑到您在问题中引用了“图书订单”,我相信您可能只是在代码中的某个点交换了“图书订单”和“图书订单”谢谢。这是Rails 4.1.1的bug。我已将其更新为4.1.4,一切正常。它肯定在尝试调用该方法,所以请再看一看。谢谢。这是Rails 4.1.1的bug。我已将其更新为4.1.4,所有工作正常。
class Book < ActiveRecord::Base
DEFAULT_PRICE = 55.15
NEXT_BOOK_PERCENT = 5
has_and_belongs_to_many :pages
has_and_belongs_to_many :orders
validates :name, presence: {message: "Name can't be blank."}
validates_length_of :name, minimum: 3, maximum: 12, message: "Sorry, we can't create this book right now. Please contact us for further information."
validate :same_letter_validation
validate :validates_for_non_alphabetic
before_save :compile
#......
end
- @abstract_model.each_associated_children(object) do |association, child|