Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing value of checked box in list view always set to true

  • Loading branch information...
commit 19d6755b553ed9e217e74517f602e8a7b9e5adad 1 parent bbb72bf
@yairgo yairgo authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/active_scaffold/helpers/list_column_helpers.rb
View
5 lib/active_scaffold/helpers/list_column_helpers.rb
@@ -105,13 +105,14 @@ def active_scaffold_column_text(column, record)
def active_scaffold_column_checkbox(column, record)
column_value = record.send(column.name)
+ checked = column_value.class.to_s.include?('Class') ? column_value : column_value == 1
if column.inplace_edit and record.authorized_for?(:action => :update, :column => column.name)
id_options = {:id => record.id.to_s, :action => 'update_column', :name => column.name.to_s}
tag_options = {:tag => "span", :id => element_cell_id(id_options), :class => "in_place_editor_field"}
script = remote_function(:method => 'POST', :url => {:controller => params_for[:controller], :action => "update_column", :column => column.name, :id => record.id.to_s, :value => !column_value, :eid => params[:eid]})
- content_tag(:span, check_box_tag(tag_options[:id], 1, column_value || column_value == 1, {:onchange => script}) , tag_options)
+ content_tag(:span, check_box_tag(tag_options[:id], 1, checked, {:onchange => script}) , tag_options)
else
- check_box_tag(nil, 1, column_value || column_value == 1, :disabled => true)
+ check_box_tag(nil, 1, checked, :disabled => true)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.