开发者

Rails 3: NoMethodError in ReviewsController#create

开发者 https://www.devze.com 2023-01-31 17:27 出处:网络
I have a relationship user (has_many :reviews) and review ( belongs_to :user) and I\'m getting a NoMethodError when I try to execute create in reviews_controller.

I have a relationship user (has_many :reviews) and review ( belongs_to :user) and I'm getting a NoMethodError when I try to execute create in reviews_controller.

def create
   @review = @user.reviews.create(:service_id => 10)
end

The same que开发者_开发技巧ry works fine in the console but it gives that error when I do it through the controller.

What am I missing here?

Thank you.


Print out @user details to log to verify current_user is populating the value correctly.

0

精彩评论

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