我的代码在我没有在表单中输入任何内容时起作用,但唯一缺少的是变量" inserted_command'在变量' final_command'。该变量的代码未添加到var final_command中。当我用数字填写我的表格时,它根本不起作用。我一定是犯了一个错误,但我真的找不到它。
require 'rails_admin/config/actions'
require 'rails_admin/config/actions/base'
module RailsAdmin
module Config
module Actions
class InAppShow < RailsAdmin::Config::Actions::Base
RailsAdmin::Config::Actions.register(self)
register_instance_option :member do
true
end
register_instance_option :visible? do
authorized? && (bindings[:controller].main_app.url_for(bindings[:object]) rescue false)
end
register_instance_option :controller do
proc do
flash[:notice] = "Your customized action #{@action}"
respond_to do |format|
format.html { render file: "#{Rails.root}/app/views/in_app_show" }
end
end
end
register_instance_option :link_icon do
'icon-camera-retro'
end
register_instance_option :pjax? do
false
end
end
end
end
end