How to add new link in Active scaffold rails 3
I need to add a new "map" link on my Taxis listing page, I am using active-scaffold and Rails 3.2.1. My current page looks like this. I need to show a "map" link similar to edit / delete / show in every post. In my database, I have a name, lat, lng.
How can I do that. Please, help.
+3
source to share
1 answer
You have to add your link in the config section 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 will need to define this method in your controller as well.
def map
# do something here
end
You can read more about this here .
+1
source to share