1dayitwillmake
1dayitwillmake

Reputation: 2339

ActiveAdmin - Can a resource contain a custom block, AND be sortable?

I'm trying to basically have a toggle switch for a resource.... However when i pass the block as the second option, i can no longer sort by that column.

    column :Playable do |level|
        link_to level.playable || 'false', "levels/#{level.id}/toggle"
    end

 # ... later
    member_action :toggle do
        level = Level.find(params[:id]);
        level.update_attribute("playable", !level.playable)
        redirect_to(:back)
    end

Upvotes: 0

Views: 326

Answers (1)

PeterWong
PeterWong

Reputation: 16011

Please try:

column :Playable, :sortable => :playable do |level|
  ...
end

Upvotes: 3

Related Questions