Design/Implementation question on record (de)activation and view state preserving

What I want to achieve:

I have a model which has records that can either be activated or
deactivated. I want to show these records in a view. Based on the
state of a checkbox, the view should show either all activated records
or all records. Furthermore I would like to add a link to dis/enable a
record. This link should somehow submit the state of the checkbox too,
because I need to refresh the view after changing a records state. I
would like to do all this in ajax. Here is what i got so far:

index view

<%= check_box_tag :showDisabled, :showDisabled, false, {:onclick =>
remote_function(:method => :get, :url => { :action => “index” }, :with
=> “‘value=’+this.checked”) } %>

<%= render 'store_table' %>
<%= link_to :new_store, new_store_path, :remote => true %>

store partial

<%= store.title %> <%= store.location %> <%= store.street %> <%= store.houseNumber %> <%= store.zipCode %> <%= %> <%= store.handelsRegisterNummer %> <%= store.taxIdentificationNumber %> <%= link_to "PDF Template", store.pdfTemplate(:original, false) unless store.pdfTemplate_file_name.blank? %> <%= link_to :edit, edit_store_path(store), :remote => true %> <%= link_to :deactivate, deactivate_store_path(store), {:remote => true, 'data-with' => "',value=>'+$('showDisabled').checked"} unless store.deactivated? %> <%= link_to :activate, activate_store_path(store), :remote => true unless store.activated? %>

So, i got a working checkbox which refreshes the page through my store
partial. What isn’t working yet, are the links with included checkbox
state. I’m not sure if my checkbox is the best way to do this, so I’m
open for suggestions :slight_smile: