开发者

Rails 3 - uninitialized constant Setting::Paymentshop

I am getting still this error, Setting and Paymentshop are models.

class Setting < Acti开发者_开发百科veRecord::Base
  has_many :paymentshops
end


class PaymentShop < ActiveRecord::Base
  belongs_to :setting
end

In view I have problem on this line:

dopr.paymentshops.type_v

dopr is variable with data from Setting and type_v is column in table Paymentshops.

I would like to ask you, If could anyone help me please with this error... Thanks


Rails tries to automatically infer the model name from the relation name. With no indication of where to break the single lower-case stream of characters, it assumes that the target model is called Paymentshops.

You can explicitly override the expected class name with has_many :paymentshops, :class_name => "PaymentShop". Alternatively, you could try using has_many :payment_shops - I'm not 100% sure how Rails modifies the relation names, but I think that should map to PaymentShop directly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜