小编use*_*001的帖子

ActiveRecord :: StatementInvalid SQLite3 :: SQLException:没有这样的列:true:

我希望@messages返回@folder.messages,其中"已删除"列的值不等于true.我不确定为什么这会继续抛出SQLException.我想我没有正确格式化已删除的属性,但我不确定如何解决它.

任何帮助将不胜感激.提前致谢.

错误信息:

ActiveRecord::StatementInvalid in MailboxController#index  
SQLite3::SQLException: no such column: true: SELECT     "message_copies".* FROM       "message_copies"  WHERE     ("message_copies".folder_id = 1) AND (deleted != true)  
Run Code Online (Sandbox Code Playgroud)

应用跟踪:

app/controllers/mailbox_controller.rb:14:in `show'  
app/controllers/mailbox_controller.rb:5:in `index'  
Run Code Online (Sandbox Code Playgroud)

Mailbox_Controller.rb

1   class MailboxController < ApplicationController  
2     def index  
3       current_user = User.find(session[:user_id])  
4       @folder = Folder.where("user_id = #{current_user.id}").first  
5       show  
6       render :action => "show"  
7     end
8  
9     def show  
10      current_user = User.find(session[:user_id])  
11      @folder = Folder.where("user_id = #{current_user.id}").first  
12      @msgs = @folder.messages  
13      @ms = @msgs.where("deleted != true") …
Run Code Online (Sandbox Code Playgroud)

sqlite ruby-on-rails sqlexception sqlite3-ruby ruby-on-rails-3

7
推荐指数
1
解决办法
7221
查看次数