Translations: English
Search on Docs:
   
ActionItem Search:

#3032: Tolerance time crash with encapsulated content

Type: BugItem Feature: FilePresenter Tags:  
ScheduledFor: 0.46.2 Assigned to: RodrigoSouto Sites:  
Priority: 0 Status: Done  

Description of the bug

When you try to visit the cms with a content that is encapsulated by the FilePresenter and the TimeTolerancePlugin is activated, a crash happens:
ActionView::TemplateError (undefined method `base_class' for FilePresenter::Image:Class) on line #67 of app/views/cms/view.rhtml:
64:         <%= short_description %>
65:       </td>
66:       <td class="article-controls">
67:         <%= expirable_button article, :edit, _('Edit'), {:action => 'edit', :id => article.id} if !remove_content_button(:edit) %>
68:         <%= button_without_text :eyes, _('Public view'), article.view_url %>
69:         <%= display_spread_button(profile, article) unless article.folder? || remove_content_button(:spread)%>
70:         <% if !environment.enabled?('cant_change_homepage') && !remove_content_button(:home) %>

    /usr/lib/ruby/1.8/active_record/associations/belongs_to_polymorphic_association.rb:11:in `replace'
    /usr/lib/ruby/1.8/active_record/associations.rb:1281:in `target='
    /usr/lib/ruby/1.8/active_record/base.rb:2754:in `send'
    /usr/lib/ruby/1.8/active_record/base.rb:2754:in `attributes='
    /usr/lib/ruby/1.8/active_record/base.rb:2750:in `each'
    /usr/lib/ruby/1.8/active_record/base.rb:2750:in `attributes='
    /usr/lib/ruby/1.8/active_record/base.rb:2446:in `initialize'
    /usr/lib/ruby/1.8/active_record/validations.rb:1057:in `new'
    /usr/lib/ruby/1.8/active_record/validations.rb:1057:in `create!'
    config/plugins/tolerance_time/lib/tolerance_time_plugin.rb:16:in `expired?'
    config/plugins/tolerance_time/lib/tolerance_time_plugin.rb:63:in `content_expire_edit'
    lib/noosfero/plugin/manager.rb:31:in `send'
    lib/noosfero/plugin/manager.rb:31:in `dispatch_without_flatten'
    /usr/lib/ruby/1.8/active_record/attribute_methods.rb:226:in `map'
    lib/noosfero/plugin/manager.rb:12:in `each'
    lib/noosfero/plugin/manager.rb:12:in `__send__'
    lib/noosfero/plugin/manager.rb:12:in `each'
    lib/noosfero/plugin/manager.rb:31:in `map'
    lib/noosfero/plugin/manager.rb:31:in `dispatch_without_flatten'
    lib/noosfero/plugin/manager.rb:23:in `dispatch'
    app/helpers/cms_helper.rb:56:in `expirable_button'
    app/views/cms/view.rhtml:67:in `_run_rhtml_app47views47cms47view46rhtml'
    app/views/cms/view.rhtml:55:in `each'
    app/views/cms/view.rhtml:55:in `_run_rhtml_app47views47cms47view46rhtml'
    /usr/lib/ruby/1.8/action_view/renderable.rb:34:in `send'
    /usr/lib/ruby/1.8/action_view/renderable.rb:34:in `render'
    /usr/lib/ruby/1.8/action_view/base.rb:306:in `with_template'
    /usr/lib/ruby/1.8/action_view/renderable.rb:30:in `render'
    /usr/lib/ruby/1.8/action_view/template.rb:205:in `render_template'
    /usr/lib/ruby/1.8/action_view/base.rb:265:in `render'
    /usr/lib/ruby/1.8/action_view/base.rb:348:in `_render_with_layout'
    /usr/lib/ruby/1.8/action_view/base.rb:262:in `render'
    /usr/lib/ruby/1.8/action_controller/base.rb:1250:in `render_for_file'
    /usr/lib/ruby/1.8/action_controller/base.rb:951:in `render_without_benchmark'
    /usr/lib/ruby/1.8/action_controller/benchmarking.rb:51:in `render'
    /usr/lib/ruby/1.8/action_controller/benchmarking.rb:51:in `render'
    app/controllers/my_profile/cms_controller.rb:65:in `index'
    /usr/lib/ruby/1.8/action_controller/base.rb:1331:in `send'
    /usr/lib/ruby/1.8/action_controller/base.rb:1331:in `perform_action_without_filters'
    /usr/lib/ruby/1.8/action_controller/filters.rb:617:in `call_filters'
    /usr/lib/ruby/1.8/action_controller/filters.rb:638:in `run_before_filters'
    /usr/lib/ruby/1.8/action_controller/filters.rb:206:in `call'
    /usr/lib/ruby/1.8/action_controller/filters.rb:206:in `around_proc'
    /usr/lib/ruby/1.8/active_support/callbacks.rb:182:in `call'
    /usr/lib/ruby/1.8/active_support/callbacks.rb:182:in `evaluate_method'
    /usr/lib/ruby/1.8/action_controller/filters.rb:184:in `call'
    /usr/lib/ruby/1.8/action_controller/filters.rb:635:in `run_before_filters'
    /usr/lib/ruby/1.8/action_controller/filters.rb:615:in `call_filters'
    /usr/lib/ruby/1.8/action_controller/filters.rb:610:in `perform_action_without_benchmark'
    /usr/lib/ruby/1.8/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /usr/lib/ruby/1.8/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /usr/lib/ruby/1.8/action_controller/rescue.rb:160:in `perform_action_without_flash'
    /usr/lib/ruby/1.8/action_controller/flash.rb:146:in `perform_action'
    /usr/lib/ruby/1.8/action_controller/base.rb:532:in `send'
    /usr/lib/ruby/1.8/action_controller/base.rb:532:in `process_without_filters'
    /usr/lib/ruby/1.8/action_controller/filters.rb:606:in `process'
    /usr/lib/ruby/1.8/action_controller/base.rb:391:in `process'
    /usr/lib/ruby/1.8/action_controller/base.rb:386:in `call'
    /usr/lib/ruby/1.8/action_controller/routing/route_set.rb:437:in `call'
    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:87:in `dispatch'
    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:121:in `_call'
    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:130:in `build_middleware_stack'
    /usr/lib/ruby/1.8/action_controller/string_coercion.rb:25:in `call'
    /usr/lib/ruby/1.8/action_controller/string_coercion.rb:25:in `call'
    /usr/lib/ruby/1.8/rack/head.rb:9:in `call'
    /usr/lib/ruby/1.8/rack/methodoverride.rb:24:in `call'
    /usr/lib/ruby/1.8/action_controller/params_parser.rb:15:in `call'
    /usr/lib/ruby/1.8/action_controller/session/abstract_store.rb:122:in `call'
    /usr/lib/ruby/1.8/active_record/query_cache.rb:29:in `call'
    /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
    /usr/lib/ruby/1.8/active_record/query_cache.rb:9:in `cache'
    /usr/lib/ruby/1.8/active_record/query_cache.rb:28:in `call'
    /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
    /usr/lib/ruby/1.8/action_controller/failsafe.rb:26:in `call'
    /usr/lib/ruby/1.8/rack/lock.rb:11:in `call'
    /usr/lib/ruby/1.8/rack/lock.rb:11:in `synchronize'
    /usr/lib/ruby/1.8/rack/lock.rb:11:in `call'
    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:114:in `call'
    /usr/lib/ruby/1.8/action_controller/reloader.rb:34:in `run'
    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:108:in `call'
    /usr/lib/ruby/1.8/rack/urlmap.rb:47:in `call'
    /usr/lib/ruby/1.8/rack/urlmap.rb:41:in `each'
    /usr/lib/ruby/1.8/rack/urlmap.rb:41:in `call'
    /usr/lib/ruby/1.8/rack/content_length.rb:13:in `call'
    /usr/lib/ruby/1.8/rack/handler/webrick.rb:48:in `service'
    /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
    /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
    /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
    /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
    /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
    /usr/lib/ruby/1.8/rack/handler/webrick.rb:14:in `run'

This is happening because rails polymorphic structure tries to access the base_class method over the Presenter instead of the encapsulated content.

Steps to reproduce

  1. Create a content that is encapsulated by the FilePresenter (like an image)
  2. Enable the TimeTolerancePlugin
  3. Access the cms where the content should be listed

Testing environment

social.stoa.usp.br

-- RodrigoSouto -- 10 Mar 2014
Add comment
You need to login to be able to comment.
 

ActionItemForm edit

Title Tolerance time crash with encapsulated content
ActionItemType BugItem
Priority Low
Tags
Feature FilePresenter
Plugin ToleranceTimePlugin
ResponsibleDevelopers RodrigoSouto
ScheduledFor 0.46.2
AffectsVersion
Status Done
Ticket SAC:
who cares
Topic revision: r1 - 22 May 2015, UnknownUser

irc Talk with Devs Now!

Copyright © 2007-2019 by the Noosfero contributors
Colivre - Cooperativa de Tecnologias Livres