Tag: sqlite

在尝试保存大(ish)整数值时,获取指示编号的错误“超出ActiveRecord :: Type :: Integer且限制为4”的范围

我在我的Ruby应用程序中使用SQLite + ActiveRecord,这是我在尝试向整数字段写入一个大数字时得到的错误: 1428584647765超出ActiveRecord :: Type :: Integer的范围,限制为4 但根据SQLite文档: 该值是有符号整数,存储为1,2,3,4,6或8个字节,具体取决于值的大小。 8个字节是存储整数1428584647765的足够空间,那么为什么ActiveRecord会给我一个错误? 为什么它认为这是一个4字节的字段?

Gem :: LoadError:试图在Heroku上使用时 – Rails 4

我正在尝试将一个应用程序(只是一个简单的应用程序从Rails教程)部署到heroku但它一直给我相同的错误消息。 我使用命令: git push heroku master 它开始很好,然后突然出现这个错误: —–> Preparing app for Rails asset pipeline Running: rake assets:precompile rake aborted! Gem::LoadError: Specified ‘sqlite3’ for database adapter, but the gem is not loaded. Add `gem ‘sqlite3’` to your Gemfile. 我已经做了捆绑安装,一切顺利。 这是我的Gemfile: # Use sqlite3 as the database for Active Record gem ‘sqlite3’ 也许我在databse.yml文件中遗漏了一些东西? # Ensure the SQLite […]

无法安装sqlite3-ruby gem

我安装了xcode 3.0。 我需要安装sqlite3-ruby gem(用于rhosync)。 当我跑: sudo gem install -l sqlite3-ruby 我收到以下错误: Building native extensions. This could take a while… ERROR: Error installing sqlite3-ruby: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb checking for #include … yes checking for sqlite3_libversion_number() in -lsqlite3… yes checking for rb_proc_arity()… no checking for sqlite3_initialize()… no sqlite3-ruby only supports sqlite3 […]

点击迁移失败从sqlite到postgres rails4,ruby 1.9.3

我正在尝试将我的Rails应用程序迁移到Postgresql for heroku但是我无法从我的SQLite3数据库获取数据,这是我尝试过的: 为新数据库创建Postgres数据库用户 $ createuser f3 Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) y Shall the new role be allowed to create more new roles? (y/n) y 编辑 – 更新下面的命令 – 改为使用它 $ createuser f3 -d -s 创建所需的数据库 $ createdb -Of3 -Eutf8 […]

安装mysql的Rails – 安装mysql2时出错:错误:无法构建gem原生扩展

我有一个Rails 3.2.13应用程序,我想部署,但托管服务将需要MySQL,而不是我一直在使用的sqlite。 在从sqlite转换为MySQL的过程中,我不得不安装ruby gem mysql2 ,它在安装时给出了以下错误: 安装mysql2时出错:错误:无法构建gem原生扩展。 我已经尝试了bundle install ,以及gem install mysql2 ,但出现了相同的错误消息。 我知道对许多人sudo apt-get install libmysql-ruby libmysqlclient-dev的解决方案是sudo apt-get install libmysql-ruby libmysqlclient-dev ,但是我在Windows上使用Git Bash,所以我发现了Windows等价物(@ francois对这个问题的回答)。 我使用安装程序安装了MySQL Server 5.6 ,并运行以下命令: gem install mysql2 — ‘–with-mysql-lib=”c:\Program Files\MySQL\MySQL Server 5.6\lib” –with-mysql-include=”c:\Program Files\MySQL\MySQL Server 5.6\include”‘ 根据我的阅读,这应该成功安装’mysql2’ruby gem。 但奇怪的是,我仍然有以下错误: Temporarily enhancing PATH to include DevKit… Building native extensions with: ‘–with-mysql-lib=”c:\Program […]

如何减小iphone的sqlite3数据库的大小?

编辑:非常感谢所有的答案。 以下是目前应用优化后的结果: 切换到排序字符和运行长度编码 – 新数据库大小42M 删除布尔值上的索引 – 新数据库大小为33M 非常好的部分是这不需要在iphone代码中进行任何更改 我有一个iphone应用程序,其中包含一个以sqlite格式保存的大型字典(只读)。 我正在寻找减少DB文件大小的想法,目前这个文件非常大。 以下是sqlite DB的条目数和结果大小: franks-macbook:DictionaryMaker frank$ ls -lh dictionary.db -rw-r–r– 1 frank staff 59M 8 Oct 23:08 dictionary.db franks-macbook:DictionaryMaker frank$ wc -l dictionary.txt 453154 dictionary.txt …每个条目平均大约135个字节。 这是我的数据库架构: create table words (word text primary key, sowpods boolean, twl boolean, signature text) create index sowpods_idx on words(sowpods) create […]

通过bundler安装sqlite3 gem时出错

我正在尝试在我的帐户上安装sqlite3-ruby gem(版本1.3.4)(共享主机上的CentOS,所以我需要在没有root的情况下安装它)并且安装的sqlite版本对于更新的版本来说还不够新sqlite3-ruby,所以我需要在我的帐户下编译库。 我使用的sqlite版本是1.7.0,因为我发现更新版本存在问题。 我已经完成了这项工作 – 我下载了sqlite-3.7.0.tar.gz并按如下方式安装: ./configure –prefix=$HOME make && make install 然后去了我的rails 3应用程序并运行以下内容: bundle config build.sqlite3-ruby “–with-sqlite3-include=$HOME/include –with-sqlite3-lib=$HOME/lib” 然后: bundle install –path vendor/bundle 但是,我得到以下内容,我的软件包无法完全安装: Installing sqlite3 (1.3.4) with native extensions /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:533:in `build_extensions’: ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) /usr/bin/ruby extconf.rb checking for sqlite3.h… yes checking for sqlite3_libversion_number() in -lsqlite3… yes checking for […]

Ruby Sqlite3安装sqlite3_libversion_number()macOS Sierra

我正在尝试安装Metasploit框架(不重要),而bundler正在尝试安装sqlite3,这是它一直失败的地方。 安装了Sqlite3(在命令行执行sqlite3将我带入环境)并使用brew link sqlite3进行brew link sqlite3 (并且由于某种原因添加了–force)但是每次使用此错误时, bundler install都会失败: sudo gem install sqlite3 Building native extensions. This could take a while… ERROR: Error installing sqlite3: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb Error: Running Homebrew as root is extremely dangerous and no longer supported. As Homebrew does not drop privileges on installation you […]

Active Admin – 根据第一个下拉菜单Ruby on Rails刷新第二个下拉列表

我在Ruby on Rails上使用Active Admin Gem。 我有一个表单,我已选择类别和子类别,然后我必须填写数据。 所以我在sqlite中创建了两个在活动管理资源中添加的表。 每件事情都运行良好,但子类别的下拉不会根据选择的类别进行过滤。 我也是Ruby和RoR的新手。 我不知道在选择类别后如何刷新子类别的下拉列表。 我知道我可以从AJAX和javascript做到但我不知道在哪里编码? 此外,Active Admin中是否有任何特定的filter可以在没有ajax或javascript的情况下实现。 任何想法或帮助将受到高度赞赏。