草庐IT

add_theme_support

全部标签

ruby-on-rails - 从 ActiveAdmin has_many 表单助手中删除 "Add new"按钮

我在事件管理员编辑页面中有嵌套资源,但我只想允许管理员编辑现有资源的内容,而不是添加新的嵌套资源。我的代码看起来像这样:formdo|f|f.inputsdof.input:authorf.input:contentf.has_many:commentsdo|comment_form|comment_form.input:contentcomment_form.input:_destroy,as::boolean,required:false,label:'Remove'endendf.actionsend但它在输入下添加了“添加新评论”按钮。我怎样才能禁用它,并只为主窗体保留f.ac

ruby-on-rails - 当需要 active_support 时,cattr_accessor 不工作(在 rails 之外)?

我不熟悉active_support,所以请多多包涵!Fox'slibrary允许通过谷歌的API进行搜索,但它需要积极的支持。我似乎无法让它工作!有什么想法吗?require'rubygems'require'active_support'require'google_search'pGoogleSearch.web:q=>"HelloWorld!"给我:NoMethodError:undefinedmethod‘cattr_accessor’forGoogleSearch:Class知道我做错了什么吗? 最佳答案 通过更多的谷歌

ruby-on-rails - Rails add_index 算法 : :concurrently still causes database lock up during migration

为了防止在迁移到生产站点期间出现数据库事务错误,我们遵循了https://github.com/LendingHome/zero_downtime_migrations中列出的建议。(具体由https://robots.thoughtbot.com/how-to-create-postgres-indexes-concurrently-in概述),但在特别大的表上创建索引期间,即使是索引创建的“并发”方法也会锁定表并导致该表上的任何ActiveRecord创建或更新导致各自的事务失败有PG::InFailedSqlTransaction异常。下面是我们运行Rails4.2(使用Acti

ruby-on-rails - 活跃商家 : How to authorise cards when using gateways that do not support the void operation?

我正在使用ActiveMerchant开发RubyonRails应用程序的计费组件。我们选择的支付网关是PaymentExpress.我看到的代码示例如下所示,使用authorize()和void()来测试卡的有效性:deftest_card!auth_response=gateway.authorize(100,card)gateway.void(auth_response.authorization)ifauth_response.success?raiseAuthorizationFailed.new(auth_response)unlessauth_response.succe

ruby-on-rails - Ruby on Rails 教程 - 5.26 - Sublime Text "Unable to Save"新文件 "spec/support/utilities.rb"

我正在使用SublimeText2,同时遵循MichaelHartl的RubyonRails教程。可以在http://ruby.railstutorial.org/book/ruby-on-rails-tutorial找到我所指的教程的具体部分。(ctrl+F“list5.26”)。我能够创建规范/支持文件。但是,在尝试创建spec/support/utilities.rb文件时,我收到消息“无法保存~/rails_projects/sample_app/spec/support/utilities.rb”。有人知道为什么会这样吗?SublimeText论坛上有人似乎遇到了完全相同的问

ruby-on-rails - 试图在 gem 中要求 active_support

我有一个ruby​​gem,我想在包含在railsactive_support模块中的gem中使用Hash.from_xml方法。我的gemspec中有以下代码:gem.add_dependency'active_support','~>3.0.0'但是,当我在本地构建和安装gem、运行irb、需要gem时,我没有看到包含主动支持的方法?关于我做错了什么或如何调试有什么建议吗?谢谢! 最佳答案 您需要从ActiveSupport要求您需要的方法;默认情况下不添加它们。正如Yevgeniy在评论中提到的那样,如果您需要所有内容,则执行

nginx配置https后报错nginx: [emerg] https protocol requires SSL support in XXX.conf详细解决方法

一、前言最近,在测试环境的nginx里增加了一个https配置:location/api-meeting-qq/{proxy_passhttps://api.meeting.qq.com/;}然后,执行命令://这个是nginx启动文件的路径,根据实际情况自行更改sudo/home/useradmin/nginx/sbin/nginx-sreload结果,nginx就报错了:nginx:[emerg]httpsprotocolrequiresSSLsupportin/home/useradmin/nginx/conf.d/trainNginx.conf:9二、解决方法百度发现,是之前安装ngi

ruby-on-rails - 对于新的 ActiveRecord 模型,为什么有些 has_many :through associations add a (1=0) predicate and distinct clause to the sql query?

每当我实例化一个新的ActiveRecord模型(一个尚未持久化到数据库中的模型)并尝试访问构建模型上的一些各种关联时,Rails查询构建器有时会:将(1=0)谓词添加到查询的where子句。在select语句中添加“distinct”子句。我认为这只会在has_many:through关联连接两个或多个表时发生。我想知道为什么它添加了(1=0)谓词以及distinct子句。对于(1=0)谓词,新模型是否已保存到数据库应该无关紧要(对吧?)。我不知道为什么要添加distinct子句。我在下面有一个简单的例子。classAssignment#s.assignment_attachment

ruby - 如何在 rails_admin 的编辑表单中隐藏 "Save and Add Another"按钮?

我在我的Rails应用程序中应用了rails_admingem。我想删除特定模型编辑表单中一些不必要的按钮,并添加我自己的自定义按钮。请查看屏幕截图,了解我要删除的内容。 最佳答案 @montells复制https://github.com/sferik/rails_admin/blob/master/app/views/rails_admin/main/_submit_buttons.html.haml这个页面在你的repo中,位于“views/rails_admin/main/_submit_buttons.html.haml”

ruby - 如何解析 "Your bundle only supports platforms ["x86-mingw3 2"] but your local platforms are ["ruby​​", "x86_64-linux"]"

我正在Windows机器上构建一个Rails站点,但是当我检查我的Gemfile.lock时,我在我的Travis构建中遇到以下错误:Yourbundleonlysupportsplatforms["x86-mingw32"]butyourlocalplatformsare["ruby","x86_64-linux"],andthere'snocompatiblematchbetweenthosetwo列表这是完整的日志:https://travis-ci.org/bikebike/BikeBike/builds/222395810#L654我查看了我的Gemfile.lock并指出: