大佬教程收集整理的这篇文章主要介绍了ruby-on-rails-3 – 错误:运算符不存在:字符变化=整数,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<% unless @user.hotels.empty? %> <% @user.hotels.each do |hotel| %> <%= "#{hotel.description} #{hotel.namE} in #{hotel.city},#{hotel.country}" %><br /> <% end %> <% end %>
这是从heroku日志:
ActionView::Template::Error (PGError: ERROR: operator does not exist: character varying = Integer LINE 1: @R_772_10288@CT "hotels".* FROM "hotels" WHERE ("hotels".user_id = 1) ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. : @R_772_10288@CT "hotels".* FROM "hotels" WHERE ("hotels".user_id = 1)):
@ user.hotels.empty?创建错误.我知道,sqlite是相当原谅,但POSTGReSQL不是.这是酒店型号的外键:user_id:Integer
Heroku说:
@H_549_2@make sure the operator is adequate for the data type. ActiveRecord does this automatically when you use an interpolated condition form. Array conditions: :conditions => ['column1 = ? AND column2 = ?',value1,value2] Hash conditions: :conditions => { :column1 => value1,:column2 => value2 }迁移如下所示:
class CreateHotels < ActiveRecord::Migration def self.up create_table :hotels do |t| t.String :name t.String :vanity_url t.Integer :user_id ....
以上是大佬教程为你收集整理的ruby-on-rails-3 – 错误:运算符不存在:字符变化=整数全部内容,希望文章能够帮你解决ruby-on-rails-3 – 错误:运算符不存在:字符变化=整数所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。