无法将实例变量传递给部分activeadmin

时间:2017-11-07 08:27:38

标签: ruby-on-rails activeadmin

ActiveAdmin.register_page 'capture_payments' do
  content do
    @payments=Payments.all
    render :partial => 'authorised_payments', locals: {aliases: @payments}
  end
end

我的部分内容并未收到@payments。如果我尝试locals[:aliases]

,请收到以下错误消息
>>  locals[:aliases]
NameError: undefined local variable or method `locals' for #<#

1 个答案:

答案 0 :(得分:2)

locals: { aliases: @payments }传递给render,您可以访问部分内的本地变量aliases,例如:

<%= form_for(aliases) do |f| %>
# some code
<% end %>