有没有更好的方法来创建动态轨道?

时间:2019-08-29 11:58:36

标签: ruby-on-rails ruby ruby-on-rails-5 wicked-gem

在Rails中使用邪恶的宝石有更好的方法吗?

def finish_wizard_path
  public_send("#{controller_name}_path", current_user.try(controller_name.intern).id)
end

1 个答案:

答案 0 :(得分:2)

这可以通过使用url_for方法来完成

url_for(controller: controller_name, action: :new, id: current_user.id)
相关问题