vhochstein / active_scaffold

Rails 4 Version of activescaffold supporting jquery
MIT License
156 stars 34 forks source link

Error in SHow action with association #180

Closed samdebutcha closed 13 years ago

samdebutcha commented 13 years ago

I have issue:

I have Sections has_and_belongs_to_many :articles I have Articles has_and_belongs_to_many :sections with create_table :articles_sections, :id => false do |t| t.belongs_to :section t.belongs_to :article end if I add in SectionsController config.columns = [:name, .. :articles]

clicking on Show action gives code 500 error, with logger output:

ActionView::Template::Error (undefined method target=' for #<ActiveRecord::Relation:0x9927f08>): 8: <% css_class = "#{column.name}-view" 9: css_class.concat(" #{column.css_class}") unless column.css_class.nil? %> 10: <dd class="<%= css_class.strip %>"> 11: <%= show_column_value(@record, column) -%> &nbsp; 12: <% end -%> 13: </dd> 14: <% end -%> activerecord (3.1.0.rc6) lib/active_record/relation.rb:459:inmethod_missing' activerecord (3.1.0.rc6) lib/active_record/associations/collection_proxy.rb:102:in send' activerecord (3.1.0.rc6) lib/active_record/associations/collection_proxy.rb:102:inmethod_missing' tmp/active_scaffold2/lib/active_scaffold/helpers/list_column_helpers.rb:238:in cache_association' tmp/active_scaffold2/lib/active_scaffold/helpers/list_column_helpers.rb:163:informat_column_value' tmp/active_scaffold2/lib/active_scaffold/helpers/list_column_helpers.rb:20:in get_column_value' tmp/active_scaffold2/lib/active_scaffold/helpers/show_column_helpers.rb:19:inshow_column_value' tmp/active_scaffold2/frontends/default/views/_show_columns.html.erb:11:in _tmp_active_scaffold__frontends_default_views__show_columns_html_erb___1284910437_80821500' tmp/active_scaffold2/lib/active_scaffold/data_structures/action_columns.rb:76:ineach' tmp/active_scaffold2/lib/active_scaffold/data_structures/action_columns.rb:68:in each' tmp/active_scaffold2/frontends/default/views/_show_columns.html.erb:2:in_tmp_active_scaffoldfrontends_default_viewsshow_columns_html_erb___1284910437_80821500' actionpack (3.1.0.rc6) lib/action_view/template.rb:144:in send' actionpack (3.1.0.rc6) lib/action_view/template.rb:144:inrender'

samdebutcha commented 13 years ago

I forgot to mention: I have also class Section < ActiveRecord::Base has_many :section_translations, :dependent => :destroy

class SectionTranslation < ActiveRecord::Base belongs_to :section

and I use Globalize3 gem

vhochstein commented 13 years ago

I hope that I ve fixed that issue with my latest commit

samdebutcha commented 13 years ago

Thank you very much, this works now!

On 09/02/2011 11:38 PM, vhochstein wrote:

I hope that I ve fixed that issue with my latest commit

vhochstein commented 13 years ago

Cool. I love to close a bug