Created
February 24, 2009 23:50
-
-
Save kofno/69881 to your computer and use it in GitHub Desktop.
two patches, one just for betternestedset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/webapp/vendor/plugins/betternestedset/lib/better_nested_set.rb | |
+++ b/webapp/vendor/plugins/betternestedset/lib/better_nested_set.rb | |
@@ -1093,17 +1093,19 @@ module SymetrieCom | |
private | |
# override the sql preparation method to exclude the lft/rgt columns | |
# under the same conditions that the primary key column is excluded | |
- def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true) #:nodoc: | |
+ def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys) #:nodoc: | |
left_and_right_column = [acts_as_nested_set_options[:left_column], acts_as_nested_set_options[:right_column]] | |
- quoted = attributes.inject({}) do |quoted, (name, value)| | |
+ quoted = {} | |
+ connection = self.class.connection | |
+ attribute_names.each do |name| | |
if column = column_for_attribute(name) | |
- quoted[name] = quote_value(value, column) unless !include_primary_key && (column.primary || left_and_right_column.include?(column.name)) | |
+ quoted[name] = connection.quote(read_attribute(name), column) unless !include_primary_key && (column.primary || left_and_right_column.include?(column.name)) | |
end | |
- quoted | |
end | |
include_readonly_attributes ? quoted : remove_readonly_attributes(quoted) | |
end | |
+ | |
# i couldn't figure out how to call attributes_with_quotes without cutting and pasting this private method in. :( | |
# Quote strings appropriately for SQL statements. | |
def quote_value(value, column = nil) #:nodoc: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fix the specs that are broken after all the upgrades | |
From: Ryan L. Bell <ryan.l.bell@gmail.com> | |
--- | |
webapp/app/helpers/application_helper.rb | 2 - | |
webapp/app/helpers/events_helper.rb | 44 ++++++++++---------- | |
webapp/app/views/morbidity_events/edit.html.erb | 4 +- | |
webapp/app/views/morbidity_events/show.html.erb | 2 - | |
webapp/spec/helpers/admin_helper_spec.rb | 2 - | |
webapp/spec/helpers/application_helper_spec.rb | 10 ++--- | |
.../helpers/core_field_elements_helper_spec.rb | 2 - | |
.../spec/helpers/core_view_elements_helper_spec.rb | 2 - | |
webapp/spec/helpers/diseases_helper_spec.rb | 2 - | |
webapp/spec/helpers/event_queues_helper_spec.rb | 2 - | |
webapp/spec/helpers/external_codes_helper_spec.rb | 2 - | |
.../spec/helpers/follow_up_elements_helper_spec.rb | 2 - | |
webapp/spec/helpers/form_elements_helper_spec.rb | 2 - | |
.../spec/helpers/question_elements_helper_spec.rb | 2 - | |
webapp/spec/helpers/users_helper_spec.rb | 2 - | |
.../spec/helpers/value_set_elements_helper_spec.rb | 2 - | |
webapp/spec/helpers/view_elements_helper_spec.rb | 2 - | |
webapp/spec/models/form_spec.rb | 4 +- | |
webapp/spec/models/view_element_spec.rb | 2 - | |
.../betternestedset/lib/better_nested_set.rb | 10 +++-- | |
20 files changed, 53 insertions(+), 49 deletions(-) | |
diff --git a/webapp/app/helpers/application_helper.rb b/webapp/app/helpers/application_helper.rb | |
index 843809b..388e1f1 100644 | |
--- a/webapp/app/helpers/application_helper.rb | |
+++ b/webapp/app/helpers/application_helper.rb | |
@@ -139,7 +139,7 @@ module ApplicationHelper | |
content_tag(:div, :class => "yui-content") do | |
capture(&block) | |
end | |
- end, block.binding) | |
+ end) | |
end | |
def format_date(date, using='%B %d, %Y') | |
diff --git a/webapp/app/helpers/events_helper.rb b/webapp/app/helpers/events_helper.rb | |
index 5ff306b..e9ffd58 100644 | |
--- a/webapp/app/helpers/events_helper.rb | |
+++ b/webapp/app/helpers/events_helper.rb | |
@@ -22,27 +22,27 @@ module EventsHelper | |
def core_element(attribute, form_builder, css_class, &block) | |
concat_core_field(:edit, :before, attribute, form_builder, block) | |
- concat("<span class='#{css_class}'>", block.binding) | |
+ concat("<span class='#{css_class}'>") | |
yield | |
render_core_field_help_text(attribute, form_builder, block) | |
- concat("</span>", block.binding) | |
+ concat("</span>") | |
concat_core_field(:edit, :after, attribute, form_builder, block) | |
end | |
def core_element_show(attribute, form_builder, css_class, &block) | |
concat_core_field(:show, :before, attribute, form_builder, block) | |
- concat("<span class='#{css_class}'>", block.binding) | |
+ concat("<span class='#{css_class}'>") | |
yield | |
render_core_field_help_text(attribute, form_builder, block) | |
- concat(" </span>", block.binding) # The is there to help resolve wrapping issues | |
+ concat(" </span>") # The is there to help resolve wrapping issues | |
concat_core_field(:show, :after, attribute, form_builder, block) | |
end | |
def core_element_print(attribute, form_builder, css_class, &block) | |
concat_core_field(:print, :before, attribute, form_builder, block) | |
- concat("<span class='#{css_class}'>", block.binding) | |
+ concat("<span class='#{css_class}'>") | |
yield | |
- concat(" </span>", block.binding) # The is there to help resolve wrapping issues | |
+ concat(" </span>") # The is there to help resolve wrapping issues | |
concat_core_field(:print, :after, attribute, form_builder, block) | |
end | |
@@ -162,8 +162,8 @@ module EventsHelper | |
controls = "" | |
controls << (link_to_function('Show', "send_url_with_tab_index('#{cmr_path(event)}')") << " | ") if with_show | |
controls << (link_to_function('Edit', "send_url_with_tab_index('#{edit_cmr_path(event)}')") << " | ") if can_update | |
- controls << link_to('Print', formatted_cmr_path(event, "print") , :target => "_blank") << " (" | |
- controls << link_to('With Notes', formatted_cmr_path(event, "print", :note => "1") , :target => "_blank") << ") | " | |
+ controls << link_to('Print', cmr_path(event, :format => "print") , :target => "_blank") << " (" | |
+ controls << link_to('With Notes', cmr_path(event, :format => "print", :note => "1") , :target => "_blank") << ") | " | |
controls << (link_to('Delete', soft_delete_cmr_path(event), :method => :post, :confirm => 'Are you sure?', :id => 'soft-delete') << " | ") if can_update && event.deleted_at.nil? | |
controls << (link_to('Add Task', new_event_task_path(event)) << " | ") if can_update | |
if with_export_options | |
@@ -321,39 +321,39 @@ module EventsHelper | |
return if event.nil? | |
if event.deleted_at.nil? | |
- concat("<div class='patientname'>", block.binding) | |
+ concat("<div class='patientname'>") | |
else | |
- concat("<div class='patientname-inactive'>", block.binding) | |
+ concat("<div class='patientname-inactive'>") | |
end | |
yield | |
- concat("</div>", block.binding) | |
+ concat("</div>") | |
end | |
def contact_name(event, &block) | |
return if event.nil? | |
if event.deleted_at.nil? | |
- concat("<div class='contactname'>", block.binding) | |
+ concat("<div class='contactname'>") | |
else | |
- concat("<div class='contactname-inactive'>", block.binding) | |
+ concat("<div class='contactname-inactive'>") | |
end | |
yield | |
- concat("</div>", block.binding) | |
+ concat("</div>") | |
end | |
def place_name(event, &block) | |
return if event.nil? | |
if event.deleted_at.nil? | |
- concat("<div class='placename'>", block.binding) | |
+ concat("<div class='placename'>") | |
else | |
- concat("<div class='placename-inactive'>", block.binding) | |
+ concat("<div class='placename-inactive'>") | |
end | |
yield | |
- concat("</div>", block.binding) | |
+ concat("</div>") | |
end | |
@@ -361,7 +361,7 @@ module EventsHelper | |
def concat_core_field(mode, before_or_after, attribute, form_builder, block) | |
return if (@event.nil? || @event.form_references.nil?) | |
- # concat("#{form_builder.object_name}[#{attribute}]", block.binding) | |
+ # concat("#{form_builder.object_name}[#{attribute}]") | |
@event.form_references.each do |form_reference| | |
core_path = form_builder.options[:core_path] || form_builder.object_name | |
configs = form_reference.form.form_element_cache.all_cached_field_configs_by_core_path("#{core_path}[#{attribute}]") | |
@@ -370,11 +370,11 @@ module EventsHelper | |
case mode | |
when :edit | |
- concat(render_investigator_view(element, @event_form, form_reference.form), block.binding) | |
+ concat(render_investigator_view(element, @event_form, form_reference.form)) | |
when :show | |
- concat(show_investigator_view(element, form_reference.form, @event_form), block.binding) | |
+ concat(show_investigator_view(element, form_reference.form, @event_form)) | |
when :print | |
- concat(print_investigator_view(element, form_reference.form, @event_form), block.binding) | |
+ concat(print_investigator_view(element, form_reference.form, @event_form)) | |
end | |
end | |
@@ -521,7 +521,7 @@ module EventsHelper | |
core_path = (form_builder.options[:core_path] || form_builder.object_name) + "[#{attribute}]" | |
core_field = @event.class.exposed_attributes[core_path] | |
help = render_help_text(core_field[:model]) if core_field | |
- concat(help, block.binding) if help | |
+ concat(help) if help | |
end | |
end | |
diff --git a/webapp/app/views/morbidity_events/edit.html.erb b/webapp/app/views/morbidity_events/edit.html.erb | |
index 8437022..8b9c829 100644 | |
--- a/webapp/app/views/morbidity_events/edit.html.erb | |
+++ b/webapp/app/views/morbidity_events/edit.html.erb | |
@@ -37,7 +37,7 @@ with TriSano. If not, see http://www.gnu.org/licenses/agpl-3.0.txt. | |
<% end %> | |
<% content_for :tools do %> | |
- <%= link_to_function('Show', "send_url_with_tab_index('#{cmr_path(@event)}')") %> | | |
+ <%= link_to_function('Show', "send_url_with_tab_index('#{cmrs_path(@event)}')") %> | | |
<%= link_to 'Back to list', cmrs_path %> | |
<% end %> | |
@@ -47,7 +47,7 @@ with TriSano. If not, see http://www.gnu.org/licenses/agpl-3.0.txt. | |
<div id="follow-up-error"></div> | |
-<% form_for(@event, :url => cmr_path(@event), :builder => ExtendedFormBuilder, :html => { :onsubmit => "this.action = build_url_with_tab_index(this.action);" } ) do |event_form| %> | |
+<% form_for(@event, :url => cmrs_path(@event), :builder => ExtendedFormBuilder, :html => { :onsubmit => "this.action = build_url_with_tab_index(this.action);" } ) do |event_form| %> | |
<% @event_form = event_form %> | |
<%# Allow jurisdictions to be changed in development mode, not production %> | |
diff --git a/webapp/app/views/morbidity_events/show.html.erb b/webapp/app/views/morbidity_events/show.html.erb | |
index c76d523..e6390ca 100644 | |
--- a/webapp/app/views/morbidity_events/show.html.erb | |
+++ b/webapp/app/views/morbidity_events/show.html.erb | |
@@ -42,7 +42,7 @@ with TriSano. If not, see http://www.gnu.org/licenses/agpl-3.0.txt. | |
</table> | |
<% end %> | |
-<%= render :partial => 'morbidity_events/export_options', :locals => { :path => formatted_cmr_path(@event, 'csv') } %> | |
+<%= render :partial => 'morbidity_events/export_options', :locals => { :path => cmr_path(@event, :format => 'csv') } %> | |
<% form_for(@event, :url => cmr_path(@event), :builder => ExtendedFormBuilder) do |event_form| %> | |
<% tabs = [] | |
diff --git a/webapp/spec/helpers/admin_helper_spec.rb b/webapp/spec/helpers/admin_helper_spec.rb | |
index f37048a..3bf9a55 100644 | |
--- a/webapp/spec/helpers/admin_helper_spec.rb | |
+++ b/webapp/spec/helpers/admin_helper_spec.rb | |
@@ -21,7 +21,7 @@ describe AdminHelper do | |
#Delete this example and add some real ones or delete this file | |
it "should include the AdminHelper" do | |
- included_modules = self.metaclass.send :included_modules | |
+ included_modules = helper.metaclass.send :included_modules | |
included_modules.should include(AdminHelper) | |
end | |
diff --git a/webapp/spec/helpers/application_helper_spec.rb b/webapp/spec/helpers/application_helper_spec.rb | |
index 852adc0..1f6b138 100644 | |
--- a/webapp/spec/helpers/application_helper_spec.rb | |
+++ b/webapp/spec/helpers/application_helper_spec.rb | |
@@ -23,7 +23,7 @@ describe ApplicationHelper do | |
question = Question.create({:question_text => "?", :data_type => "single_line_text"}) | |
question_element = QuestionElement.create(:tree_id => "1", :question => question) | |
- replace_element, replace_partial = replacement_elements(question_element) | |
+ replace_element, replace_partial = helper.replacement_elements(question_element) | |
replace_element.should eql("library-admin") | |
replace_partial.should eql("forms/library_admin") | |
@@ -38,7 +38,7 @@ describe ApplicationHelper do | |
form_base_element.add_child(investigator_view_element_container) | |
investigator_view_element_container.add_child(question_element) | |
- replace_element, replace_partial = replacement_elements(question_element) | |
+ replace_element, replace_partial = helper.replacement_elements(question_element) | |
replace_element.should eql("root-element-list") | |
replace_partial.should eql("forms/elements") | |
@@ -53,7 +53,7 @@ describe ApplicationHelper do | |
form_base_element.add_child(core_view_element_container) | |
core_view_element_container.add_child(question_element) | |
- replace_element, replace_partial = replacement_elements(question_element) | |
+ replace_element, replace_partial = helper.replacement_elements(question_element) | |
replace_element.should eql("core-element-list") | |
replace_partial.should eql("forms/core_elements") | |
@@ -68,14 +68,14 @@ describe ApplicationHelper do | |
form_base_element.add_child(core_field_element_container) | |
core_field_element_container.add_child(question_element) | |
- replace_element, replace_partial = replacement_elements(question_element) | |
+ replace_element, replace_partial = helper.replacement_elements(question_element) | |
replace_element.should eql("core-field-element-list") | |
replace_partial.should eql("forms/core_field_elements") | |
end | |
it "should format date correctly" do | |
- format_date(Time.parse('8/21/2002')).should eql('August 21, 2002') | |
+ helper.format_date(Time.parse('8/21/2002')).should eql('August 21, 2002') | |
end | |
end | |
diff --git a/webapp/spec/helpers/core_field_elements_helper_spec.rb b/webapp/spec/helpers/core_field_elements_helper_spec.rb | |
index 26ce9de..b2eb82f 100644 | |
--- a/webapp/spec/helpers/core_field_elements_helper_spec.rb | |
+++ b/webapp/spec/helpers/core_field_elements_helper_spec.rb | |
@@ -21,7 +21,7 @@ describe CoreFieldElementsHelper do | |
#Delete this example and add some real ones or delete this file | |
it "should include the CoreFieldElementHelper" do | |
- included_modules = self.metaclass.send :included_modules | |
+ included_modules = helper.metaclass.send :included_modules | |
included_modules.should include(CoreFieldElementsHelper) | |
end | |
diff --git a/webapp/spec/helpers/core_view_elements_helper_spec.rb b/webapp/spec/helpers/core_view_elements_helper_spec.rb | |
index a073e27..e043835 100644 | |
--- a/webapp/spec/helpers/core_view_elements_helper_spec.rb | |
+++ b/webapp/spec/helpers/core_view_elements_helper_spec.rb | |
@@ -21,7 +21,7 @@ describe CoreViewElementsHelper do | |
#Delete this example and add some real ones or delete this file | |
it "should include the CoreViewElementHelper" do | |
- included_modules = self.metaclass.send :included_modules | |
+ included_modules = helper.metaclass.send :included_modules | |
included_modules.should include(CoreViewElementsHelper) | |
end | |
diff --git a/webapp/spec/helpers/diseases_helper_spec.rb b/webapp/spec/helpers/diseases_helper_spec.rb | |
index f241dab..503fccf 100644 | |
--- a/webapp/spec/helpers/diseases_helper_spec.rb | |
+++ b/webapp/spec/helpers/diseases_helper_spec.rb | |
@@ -21,7 +21,7 @@ describe DiseasesHelper do | |
#Delete this example and add some real ones or delete this file | |
it "should include the DiseaseHelper" do | |
- included_modules = self.metaclass.send :included_modules | |
+ included_modules = helper.metaclass.send :included_modules | |
included_modules.should include(DiseasesHelper) | |
end | |
diff --git a/webapp/spec/helpers/event_queues_helper_spec.rb b/webapp/spec/helpers/event_queues_helper_spec.rb | |
index 21ba979..308d95a 100644 | |
--- a/webapp/spec/helpers/event_queues_helper_spec.rb | |
+++ b/webapp/spec/helpers/event_queues_helper_spec.rb | |
@@ -21,7 +21,7 @@ describe EventQueuesHelper do | |
#Delete this example and add some real ones or delete this file | |
it "should include the EventQueueHelper" do | |
- included_modules = self.metaclass.send :included_modules | |
+ included_modules = helper.metaclass.send :included_modules | |
included_modules.should include(EventQueuesHelper) | |
end | |
diff --git a/webapp/spec/helpers/external_codes_helper_spec.rb b/webapp/spec/helpers/external_codes_helper_spec.rb | |
index c1fbc57..c2d679e 100644 | |
--- a/webapp/spec/helpers/external_codes_helper_spec.rb | |
+++ b/webapp/spec/helpers/external_codes_helper_spec.rb | |
@@ -21,7 +21,7 @@ describe ExternalCodesHelper do | |
#Delete this example and add some real ones or delete this file | |
it "should include the ExternalCodeHelper" do | |
- included_modules = self.metaclass.send :included_modules | |
+ included_modules = helper.metaclass.send :included_modules | |
included_modules.should include(ExternalCodesHelper) | |
end | |
diff --git a/webapp/spec/helpers/follow_up_elements_helper_spec.rb b/webapp/spec/helpers/follow_up_elements_helper_spec.rb | |
index 7ab7ea6..cff3bd6 100644 | |
--- a/webapp/spec/helpers/follow_up_elements_helper_spec.rb | |
+++ b/webapp/spec/helpers/follow_up_elements_helper_spec.rb | |
@@ -21,7 +21,7 @@ describe FollowUpElementsHelper do | |
#Delete this example and add some real ones or delete this file | |
it "should include the FollowUpElementHelper" do | |
- included_modules = self.metaclass.send :included_modules | |
+ included_modules = helper.metaclass.send :included_modules | |
included_modules.should include(FollowUpElementsHelper) | |
end | |
diff --git a/webapp/spec/helpers/form_elements_helper_spec.rb b/webapp/spec/helpers/form_elements_helper_spec.rb | |
index 37c8489..70448c7 100644 | |
--- a/webapp/spec/helpers/form_elements_helper_spec.rb | |
+++ b/webapp/spec/helpers/form_elements_helper_spec.rb | |
@@ -21,7 +21,7 @@ describe FormElementsHelper do | |
#Delete this example and add some real ones or delete this file | |
it "should include the FormElementHelper" do | |
- included_modules = self.metaclass.send :included_modules | |
+ included_modules = helper.metaclass.send :included_modules | |
included_modules.should include(FormElementsHelper) | |
end | |
diff --git a/webapp/spec/helpers/question_elements_helper_spec.rb b/webapp/spec/helpers/question_elements_helper_spec.rb | |
index 91beab0..da8658e 100644 | |
--- a/webapp/spec/helpers/question_elements_helper_spec.rb | |
+++ b/webapp/spec/helpers/question_elements_helper_spec.rb | |
@@ -21,7 +21,7 @@ describe QuestionElementsHelper do | |
#Delete this example and add some real ones or delete this file | |
it "should include the QuestionElementHelper" do | |
- included_modules = self.metaclass.send :included_modules | |
+ included_modules = helper.metaclass.send :included_modules | |
included_modules.should include(QuestionElementsHelper) | |
end | |
diff --git a/webapp/spec/helpers/users_helper_spec.rb b/webapp/spec/helpers/users_helper_spec.rb | |
index c1935c2..c57e9f8 100644 | |
--- a/webapp/spec/helpers/users_helper_spec.rb | |
+++ b/webapp/spec/helpers/users_helper_spec.rb | |
@@ -21,7 +21,7 @@ describe UsersHelper do | |
#Delete this example and add some real ones or delete this file | |
it "should include the UserHelper" do | |
- included_modules = self.metaclass.send :included_modules | |
+ included_modules = helper.metaclass.send :included_modules | |
included_modules.should include(UsersHelper) | |
end | |
diff --git a/webapp/spec/helpers/value_set_elements_helper_spec.rb b/webapp/spec/helpers/value_set_elements_helper_spec.rb | |
index 9319cd4..ec7ff6d 100644 | |
--- a/webapp/spec/helpers/value_set_elements_helper_spec.rb | |
+++ b/webapp/spec/helpers/value_set_elements_helper_spec.rb | |
@@ -21,7 +21,7 @@ describe ValueSetElementsHelper do | |
#Delete this example and add some real ones or delete this file | |
it "should include the ValueSetElementHelper" do | |
- included_modules = self.metaclass.send :included_modules | |
+ included_modules = helper.metaclass.send :included_modules | |
included_modules.should include(ValueSetElementsHelper) | |
end | |
diff --git a/webapp/spec/helpers/view_elements_helper_spec.rb b/webapp/spec/helpers/view_elements_helper_spec.rb | |
index bd34df4..3db0886 100644 | |
--- a/webapp/spec/helpers/view_elements_helper_spec.rb | |
+++ b/webapp/spec/helpers/view_elements_helper_spec.rb | |
@@ -21,7 +21,7 @@ describe ViewElementsHelper do | |
#Delete this example and add some real ones or delete this file | |
it "should include the ViewElementHelper" do | |
- included_modules = self.metaclass.send :included_modules | |
+ included_modules = helper.metaclass.send :included_modules | |
included_modules.should include(ViewElementsHelper) | |
end | |
diff --git a/webapp/spec/models/form_spec.rb b/webapp/spec/models/form_spec.rb | |
index b9c010e..9b8b669 100644 | |
--- a/webapp/spec/models/form_spec.rb | |
+++ b/webapp/spec/models/form_spec.rb | |
@@ -18,6 +18,8 @@ | |
require File.dirname(__FILE__) + '/../spec_helper' | |
require 'ostruct' | |
+include ActionController::TestProcess | |
+ | |
describe Form do | |
before(:each) do | |
@form = Form.new | |
@@ -771,7 +773,7 @@ describe Form do | |
before(:each) do | |
@original_form = Form.find(forms(:hep_a_form).id) | |
- @imported_form = Form.import(fixture_file_upload('files/hep_a.zip', 'application/zip')) | |
+ @imported_form = Form.import(self.fixture_file_upload('files/hep_a.zip', 'application/zip')) | |
end | |
it 'should match the original name' do | |
diff --git a/webapp/spec/models/view_element_spec.rb b/webapp/spec/models/view_element_spec.rb | |
index 91d2ff1..60d160e 100644 | |
--- a/webapp/spec/models/view_element_spec.rb | |
+++ b/webapp/spec/models/view_element_spec.rb | |
@@ -54,7 +54,7 @@ describe ViewElement do | |
describe "when updated" do | |
it "should succeed if form validation passes" do | |
@view_element.save_and_add_to_form.should_not be_nil | |
- @view_element.update_and_validate(:name => "Updated Name").should_not be_nil | |
+ @view_element.update_and_validate(:name => "Updated Name").should be_true | |
@view_element.name.should eql("Updated Name") | |
@view_element.errors.should be_empty | |
end | |
diff --git a/webapp/vendor/plugins/betternestedset/lib/better_nested_set.rb b/webapp/vendor/plugins/betternestedset/lib/better_nested_set.rb | |
index 5bd2243..5fcd658 100644 | |
--- a/webapp/vendor/plugins/betternestedset/lib/better_nested_set.rb | |
+++ b/webapp/vendor/plugins/betternestedset/lib/better_nested_set.rb | |
@@ -1093,17 +1093,19 @@ module SymetrieCom | |
private | |
# override the sql preparation method to exclude the lft/rgt columns | |
# under the same conditions that the primary key column is excluded | |
- def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true) #:nodoc: | |
+ def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys) #:nodoc: | |
left_and_right_column = [acts_as_nested_set_options[:left_column], acts_as_nested_set_options[:right_column]] | |
- quoted = attributes.inject({}) do |quoted, (name, value)| | |
+ quoted = {} | |
+ connection = self.class.connection | |
+ attribute_names.each do |name| | |
if column = column_for_attribute(name) | |
- quoted[name] = quote_value(value, column) unless !include_primary_key && (column.primary || left_and_right_column.include?(column.name)) | |
+ quoted[name] = connection.quote(read_attribute(name), column) unless !include_primary_key && (column.primary || left_and_right_column.include?(column.name)) | |
end | |
- quoted | |
end | |
include_readonly_attributes ? quoted : remove_readonly_attributes(quoted) | |
end | |
+ | |
# i couldn't figure out how to call attributes_with_quotes without cutting and pasting this private method in. :( | |
# Quote strings appropriately for SQL statements. | |
def quote_value(value, column = nil) #:nodoc: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment