carlsednaoui / nycio

NYC Tech Volunteer Database
6 stars 2 forks source link

Refactor how Admins toggle :approved attribute for Organizations #33

Open mattjstar opened 10 years ago

mattjstar commented 10 years ago

Right now it's a basic toggle! action with a link_to post request:

def batch_actions
    if params[:toggle_id].present? && params[:toggle_id].to_i != 0
        Organization.find(params[:toggle_id]).toggle!(:approved)
        respond_to do |format|
            format.html { redirect_to admin_organizations_path, notice: 'Approval Toggled' }
        end
    end
end

With the link_to:

<%= link_to "Toggle Approval", admin_batch_actions_path(toggle_id: organization.id), :method => 'post' %>

Consider making this a true batch action where the admin can check off as many organizations as he/she wants and then toggle all at once.