Search code examples
ruby-on-rails-4collectionsactiveadminformtasticlink-to

ActiveAdmin formtastic link_to on a collection leading to the show view


Just wondering about how to have this link to this to the appropriate supplier_company_view with clickable names. The .to_sentence is optional.

column :supply_companies do |pt|
 pt.supply_companies.collect {|c| c.company_name.capitalize }.to_sentence
end

Solution

  • can do it this way but not sure if it is the best way.

    column :supply_companies do |pt|
     pt.supply_companies.map { |cn| link_to cn.company_name, 
     admin_supply_companies_path + "\/" + cn.id.to_s }.join(", ").html_safe
    end