草庐IT

DB_TempTestModel

全部标签

ruby-on-rails - rails : rake db:create:all (could not connect to server)

关注截屏视频http://railscasts.com/episodes/342-migrating-to-postgresql?autoplay=true直到"rakedb:create:all"的步骤并得到错误:couldnotconnecttoserver:NosuchfileordirectoryIstheserverrunninglocallyandacceptingconnectionsonUnixdomainsocket"/tmp/.s.PGSQL.5432"?引用Rails:rakedb:create:allfailstoconnecttoPostgreSQLdatab

ruby - 用 db 扩展 jekyll/octopress?

我一直在寻求将我的wp博客移动到octopress(基于jekyll)。我希望可以选择向网站添加成员(member)登录/注册系统以及其他动态功能,但我喜欢让我的内容静态化的想法,就像octopress提供的那样。我不一定需要在博客上发表评论。我读过octopress基于sinatra,但我不是ruby​​专家。是否可以使用sinatra来实现我想要的,或者我是否需要使用其他工具包?谢谢,B 最佳答案 在一天没有回复之后,您已经对“ruby粉丝”感到失望了......在这样的评论之后它保持沉默并不奇怪。反正Jekyll和Octopr

ruby - 如何从 PgSQL DB 获取时间

我正在尝试使用pggem获取查询的时间。我看到了文档,但没有找到任何东西。我想知道是否有类似query.time的东西。我在~/.psqlrc中添加了\timing,因此该命令默认处于事件状态。如果我在Postgres控制台中编写查询,则时间处于事件状态。这是代码:conn=PGconn.open(:dbname=>'my_db')query=conn.exec('SELECT*fromsome_table')putsquery.num_tuples->thisworkputsquery.time->undefinedmethod我需要测量Postgres本身的时间,我不能使用Ruby

ruby - rake db :schema:load loads schema. rb 多次?

从Rails3升级到Rails4后,db:schema:load任务失败。我对其进行了一些深入研究,发现在升级之后,当我运行bundleexecrakedb:schema:load时,db/schema.rb文件被加载了两次。第一次运行正常;然后第二次由于create_tableforce:true由于表上存在依赖性约束而失败。我已经删除了所有额外的rake任务并进行了增强以尝试排除我的任何代码,但这仍然会加载schema.rb两次。它总是恰好两倍,因为我能够在SQLite上成功运行它并在那里看到相同的行为,但由于SQLite没有强制执行表约束,它运行完成。

ruby-on-rails - heroku db:push 错误未初始化常量 Sequel::Postgres::PGError

这个问题不太可能帮助任何future的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visitthehelpcenter.关闭12年前。我在运行herokudb:pull和db:push命令时遇到问题。我的应用在bamboo-ree-1.8.7堆栈上运行Rails3。我是Sequel的新手,不确定脚本在提示什么。$herokudb:pushLoadedTapsv0.3.14自动检测本地数据库:postgres://xxx@127.0.0.1/xxx_development?encodin

ruby-on-rails - 使用 rake db :migrate does not change it 迁移数据

我正在为rails和db:migrate苦苦挣扎。我有一个使用此代码的迁移classSetDefaultInstallmentsForLicenses运行迁移后有这个输出==SetDefaultInstallmentsForLicenses:migrating==============================Modifyinglicense3withcodeLEADERAftersavetrue5Aftersavef==SetDefaultInstallmentsForLicenses:migrated(0.0037s)=====================可以清楚的看到

ruby-on-rails - 在 db fetch 之后子类化 activerecord 并维护子类

我有一个ActiveRecord模型Media,它应该能够存储关于不同类型媒体的类似结构信息(Media::Book,Media::电影,媒体::音乐)。然而,这些子类中的每一个都有独特的方法。#TABLEmedias#string:title#string:description#integer:media_typeclassMedia如果我使用Media::Book.new("HarryPotter").reviews会起作用,但我希望能够使用Media.find("HarryPotter")=>Media::Book和Media.find("HarryPotter").revie

ruby-on-rails - rake 数据库 :seed before db:migrate

每次播种时,rakedb:migrate都会出现错误。我不想迁移,因为它由于在我的数据库中查找尚不存在的表而失败。我怎样才能忽略它并继续使用种子?mmahalwy@~/Desktop/Code/API[56]→rakedb:seedYouhave4pendingmigrations:20141206123759AddEsAnalyzerColumnToLanguageTable20141213090426CreateTextFontView20141213090434UpdateLemmaAndStem20141230124205ChangeTextFontViewRun`rakedb

ruby-on-rails - 使用 rake db :create 创建 Rails DB 时出错

我正在尝试使用rails'gettingstartedguide运行我的第一个“helloworld”rails示例在我的OSX10.6.3盒子上。当我执行第一个rakedb:create命令时(我使用的是mysql),我得到:simon@/Users/simon/source/rails/blog/config:rakedb:create(in/Users/simon/source/rails/blog)Couldn'tcreatedatabasefor{"reconnect"=>false,"encoding"=>"utf8","username"=>"root","adapter

ruby-on-rails - 设计用户的 rails pg db 迁移未定义方法 `database_authenticatable'

undefinedmethoddatabase_authenticatable'for#迁移是:classDeviseCreateUsersfalset.recoverablet.rememberablet.trackablet.timestampsendadd_index:users,:email,:unique=>trueadd_index:users,:reset_password_token,:unique=>trueenddefself.downdrop_table:usersendend 最佳答案 如果我没记错的话,设计