I need to add a new link 'map' in my Taxis listing page, I am using active-scaffold and Rails 3.2.1. My current page looks like the below. I need to show a link 'map' similar to edit/delete/show in each record. In my database I have fields name, lat, lng.

enter image description here

How can this be done. Please help.

有帮助吗?

解决方案

You have to add your link in the configure part in your controller.

I did it like this:

controller Admin::TaxisController < Admin::ApplicationController
  active_scaffold :taxi do |config|
    config.action_links << ActiveScaffold::DataStructures::ActionLink.new('map', :label => I18n.t('map'), :type => :member, :inline => false, :position => true)
  end
end

Of course you'll need to define this method in your controller as well.

def map
  # do something here
end

You can read more about it here.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top