我正在使用Active Admin gem为管理后端开发Rails 4应用程序.Active Admin反过来使用Devise进行用户身份验证.现在,当我尝试capistrano在VPS服务器上部署应用程序时,我收到以下错误:
rake aborted!
Devise.secret_key was not set. Please add the following to your Devise initializer:
config.secret_key = '-- secret key --'
Run Code Online (Sandbox Code Playgroud)
Google搜索对此错误没有太大作用.有什么建议为什么它会抛出错误?我应该将密钥添加到devise初始化程序,因为我找不到任何设置此类配置密钥的地方initializers/devise.rb?
任何人都可以告诉我如何让TinyMCE停止将我的URL转换为Plone中的相关链接?
例如,如果我在HTML源代码中输入:
<img src="/images/dir/subdir/my_image.png" />
Run Code Online (Sandbox Code Playgroud)
它会将其转换为:
<img src="../../../my_image.png" />
Run Code Online (Sandbox Code Playgroud)
我编辑了tiny_mce.js(在portal_skins中)来设置:
convert_urls:false,
relative_urls:false,
Run Code Online (Sandbox Code Playgroud)
但没有效果.我在这里阅读了所有类似的帖子,但没有人真正回答这个问题.
如果用户通过浏览文件系统(即目录)来选择图像,那么它就可以了.我只是想让它尊重我在html框中键入的内容...这样我就可以选择强制一个绝对路径,如果我认为合适的话.这是kupu的标准行为.
有任何想法吗?
我需要gem ruby-filemagic来满足我项目中的一些要求.在运行bundle install时,它给了我这个错误
*** ERROR: missing required library to compile this module
*** extconf.rb failed ***
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题.
由于Heroku不允许将动态文件保存到磁盘,我遇到了一个两难的境地,我希望你能帮我克服.我有一个可以在RAM中创建的文本文件.问题是我找不到允许我将文件流式传输到另一个FTP服务器的gem或函数.我正在使用的Net/FTP gem需要先将文件保存到磁盘.有什么建议?
ftp = Net::FTP.new(domain)
ftp.passive = true
ftp.login(username, password)
ftp.chdir(path_on_server)
ftp.puttextfile(path_to_web_file)
ftp.close
Run Code Online (Sandbox Code Playgroud)
ftp.puttextfile函数是需要物理文件存在的函数.
我正在使用ActiveAdmin和Formtastic.
我有一张发票表单,上面有一个下载菜单.
form do |f|
f.inputs "Shipment Details" do
f.input :shipment_id, :label => "Shipment", :as => :select, :collection => Shipment.find(invoiceless_shipments, :order => "file_number", :select => "id, file_number").map{|v| [v.file_number, v.id] }
f.input :issued_at, :label => "Date", :as => :datepicker
... more fields ...
end
Run Code Online (Sandbox Code Playgroud)
如果表单是新发票表单,我只想显示货件的选择菜单.
如果表单是编辑表单,我不想显示发货下拉选择菜单.因此,如果表单是编辑表单,则不会更改.
我在考虑做类似的事情
if params[:action] != 'edit'
f.input :shipment_id, :label => "Shipment", :as => :select...
end
Run Code Online (Sandbox Code Playgroud)
但我收到DSL错误.
如何为以下ActiveAdmin代码编写控制器和功能规范:
# app/admin/organization.rb
ActiveAdmin.register Organization do
batch_action :approve do |selection|
Organization.find(selection).each {|organization| organization.approve }
redirect_to collection_path, notice: 'Organizations approved.'
end
end
Run Code Online (Sandbox Code Playgroud)
这是我的功能规格.它找不到ActiveAdmin在弹出菜单中加载的"批处理操作".
# spec/features/admin/organization_feature_spec.rb
require 'spec_helper'
include Devise::TestHelpers
describe 'Admin Organization' do
before(:each) do
@user = FactoryGirl.create(:admin_user)
login('admin@company.com', 'password1')
end
it 'approves in batch' do
organization = FactoryGirl.create(:organization)
visit admin_organizations_path
check 'collection_selection_toggle_all'
click_link 'Batch Actions'
click_link 'Approve Selected'
organization.reload
organization.state.should eq 'approved'
end
end
Run Code Online (Sandbox Code Playgroud)
版本
我有一个用户注册页面,并将信息发送给一个新用户在该站点中注册的几个管理员用户.
现在,我用用户列表(200+)创建了种子数据.因此,它会向相应的管理员用户发送200多封电子邮件.因此,我想在创建新用户时停止向管理员用户发送邮件确认.
如何在ActiveAdmin中显示textarea以编辑hstore字段?
目前,当我想打开编辑表单时出现错误:
Formtastic::UnknownInputError
Unable to find input class for hstore
Run Code Online (Sandbox Code Playgroud)
感谢帮助
有谁知道如何解决这个弃用?我已经包含了弃用警告和违规迁移文件.
弃用警告:不推荐使用ActiveRecord :: Migrator.proper_table_name,将在Rails 4.2中删除.请改用ActiveRecord :: Migration上的proper_table_name实例方法.(从项目变更调用/ db/migrate/20141010204446_add_state_to_uploads.rb:4)
# db/migrate/20141010204446_add_state_to_uploads.rb
class AddStateToUploads < ActiveRecord::Migration
def change
add_column :uploads, :state, :string, index: true
add_index :uploads, :state
end
end
Run Code Online (Sandbox Code Playgroud)
引用:
自动删除页面框架的最佳方法是什么?
我之前使用过这种类型的代码:
<script language="JavaScript">
setTimeout ("changePage()", 3000);
function changePage() {
if (self.parent.frames.length != 0)
self.parent.location="http://www.example.com";
}
</script>
Run Code Online (Sandbox Code Playgroud)