Created
November 15, 2011 20:39
-
-
Save partydrone/1368265 to your computer and use it in GitHub Desktop.
expire_action producing `can't convert Symbol into Integer` error
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
class DownloadTypeSweeper < ActionController::Caching::Sweeper | |
observe DownloadType | |
def after_save(download_type) | |
expire_cache_for download_type | |
end | |
def before_destroy(download_type) | |
expire_cache_for download_type | |
end | |
private | |
def expire_cache_for(download_type) | |
# Expire page caches | |
# When the list order changes, expire all product support pages | |
@products = Product.all | |
@products.each do |product| | |
expire_action support_product_line_product_url(product.product_line_id, product) | |
end | |
end | |
end |
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
module Admin | |
class DownloadTypesController < BaseController | |
cache_sweeper :download_type_sweeper, :only => [:create, :update, :destroy] | |
# GET /download_types | |
def index | |
@download_types = DownloadType.order('position ASC') | |
end | |
# GET /:locale/admin/download_types/new | |
def new | |
@download_type = DownloadType.new | |
end | |
# GET /:locale/admin/download_types/1/edit | |
def edit | |
@download_type = DownloadType.find(params[:id]) | |
end | |
# POST /:locale/admin/download_types | |
def create | |
@download_type = DownloadType.new(params[:download_type]) | |
if @download_type.save | |
flash[:notice] = "<em>#{@download_type.name}</em> was successfully created." | |
redirect_to admin_download_types_path | |
else | |
render :action => 'new' | |
end | |
end | |
# PUT /:locale/admin/download_types/1 | |
def update | |
@download_type = DownloadType.find(params[:id]) | |
if @download_type.update_attributes(params[:download_type]) | |
redirect_to admin_download_types_path | |
else | |
render :action => 'edit' | |
end | |
end | |
# PUT /:locale/admin/download_types/sort | |
def sort | |
params[:download_type].each_with_index do |id, index| | |
DownloadType.update_all({ position: index + 1 }, { id: id }) | |
end | |
# Expire page caches | |
@products = Product.all | |
@products.each do |product| | |
expire_action support_product_line_product_path(product.product_line_id, product) | |
end | |
render nothing: true | |
end | |
# DELETE /:locale/admin/download_types/1 | |
def destroy | |
@download_type = DownloadType.find(params[:id]) | |
@download_type.destroy | |
redirect_to admin_download_types_path | |
end | |
end | |
end |
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
actionpack (3.1.1) lib/action_controller/caching/actions.rb:119:in `[]' | |
actionpack (3.1.1) lib/action_controller/caching/actions.rb:119:in `expire_action' | |
actionpack (3.1.1) lib/action_controller/caching/sweeping.rb:92:in `method_missing' | |
app/sweepers/download_type_sweeper.rb:19:in `block in expire_cache_for' | |
app/sweepers/download_type_sweeper.rb:18:in `each' | |
app/sweepers/download_type_sweeper.rb:18:in `expire_cache_for' | |
app/sweepers/download_type_sweeper.rb:5:in `after_save' | |
activemodel (3.1.1) lib/active_model/observing.rb:232:in `update' | |
activerecord (3.1.1) lib/active_record/observer.rb:114:in `block (2 levels) in define_callbacks' | |
activesupport (3.1.1) lib/active_support/callbacks.rb:401:in `_run_save_callbacks' | |
activesupport (3.1.1) lib/active_support/callbacks.rb:81:in `run_callbacks' | |
activerecord (3.1.1) lib/active_record/callbacks.rb:264:in `create_or_update' | |
activerecord (3.1.1) lib/active_record/persistence.rb:37:in `save' | |
activerecord (3.1.1) lib/active_record/validations.rb:50:in `save' | |
activerecord (3.1.1) lib/active_record/attribute_methods/dirty.rb:22:in `save' | |
activerecord (3.1.1) lib/active_record/transactions.rb:241:in `block (2 levels) in save' | |
activerecord (3.1.1) lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status' | |
activerecord (3.1.1) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction' | |
activerecord (3.1.1) lib/active_record/transactions.rb:208:in `transaction' | |
activerecord (3.1.1) lib/active_record/transactions.rb:293:in `with_transaction_returning_status' | |
activerecord (3.1.1) lib/active_record/transactions.rb:241:in `block in save' | |
activerecord (3.1.1) lib/active_record/transactions.rb:252:in `rollback_active_record_state!' | |
activerecord (3.1.1) lib/active_record/transactions.rb:240:in `save' | |
app/controllers/admin/download_types_controller.rb:25:in `create' | |
actionpack (3.1.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action' | |
actionpack (3.1.1) lib/abstract_controller/base.rb:167:in `process_action' | |
actionpack (3.1.1) lib/action_controller/metal/rendering.rb:10:in `process_action' | |
actionpack (3.1.1) lib/abstract_controller/callbacks.rb:18:in `block in process_action' | |
activesupport (3.1.1) lib/active_support/callbacks.rb:471:in `block in _run__57107674272883730__process_action__376869027667169981__callbacks' | |
activesupport (3.1.1) lib/active_support/callbacks.rb:207:in `block in _conditional_callback_around_717' | |
activesupport (3.1.1) lib/active_support/callbacks.rb:318:in `around' | |
activesupport (3.1.1) lib/active_support/callbacks.rb:302:in `_callback_around_128' | |
activesupport (3.1.1) lib/active_support/callbacks.rb:206:in `_conditional_callback_around_717' | |
activesupport (3.1.1) lib/active_support/callbacks.rb:470:in `_run__57107674272883730__process_action__376869027667169981__callbacks' | |
activesupport (3.1.1) lib/active_support/callbacks.rb:386:in `_run_process_action_callbacks' | |
activesupport (3.1.1) lib/active_support/callbacks.rb:81:in `run_callbacks' | |
actionpack (3.1.1) lib/abstract_controller/callbacks.rb:17:in `process_action' | |
actionpack (3.1.1) lib/action_controller/metal/rescue.rb:17:in `process_action' | |
actionpack (3.1.1) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' | |
activesupport (3.1.1) lib/active_support/notifications.rb:53:in `block in instrument' | |
activesupport (3.1.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument' | |
activesupport (3.1.1) lib/active_support/notifications.rb:53:in `instrument' | |
actionpack (3.1.1) lib/action_controller/metal/instrumentation.rb:29:in `process_action' | |
actionpack (3.1.1) lib/action_controller/metal/params_wrapper.rb:201:in `process_action' | |
activerecord (3.1.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action' | |
actionpack (3.1.1) lib/abstract_controller/base.rb:121:in `process' | |
actionpack (3.1.1) lib/abstract_controller/rendering.rb:45:in `process' | |
actionpack (3.1.1) lib/action_controller/metal.rb:193:in `dispatch' | |
actionpack (3.1.1) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' | |
actionpack (3.1.1) lib/action_controller/metal.rb:236:in `block in action' | |
actionpack (3.1.1) lib/action_dispatch/routing/route_set.rb:65:in `call' | |
actionpack (3.1.1) lib/action_dispatch/routing/route_set.rb:65:in `dispatch' | |
actionpack (3.1.1) lib/action_dispatch/routing/route_set.rb:29:in `call' | |
rack-mount (0.8.3) lib/rack/mount/route_set.rb:152:in `block in call' | |
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:96:in `block in recognize' | |
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:173:in `optimized_each' | |
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:95:in `recognize' | |
rack-mount (0.8.3) lib/rack/mount/route_set.rb:141:in `call' | |
actionpack (3.1.1) lib/action_dispatch/routing/route_set.rb:532:in `call' | |
actionpack (3.1.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' | |
rack (1.3.5) lib/rack/etag.rb:23:in `call' | |
rack (1.3.5) lib/rack/conditionalget.rb:35:in `call' | |
actionpack (3.1.1) lib/action_dispatch/middleware/head.rb:14:in `call' | |
actionpack (3.1.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call' | |
actionpack (3.1.1) lib/action_dispatch/middleware/flash.rb:243:in `call' | |
rack (1.3.5) lib/rack/session/abstract/id.rb:195:in `context' | |
rack (1.3.5) lib/rack/session/abstract/id.rb:190:in `call' | |
actionpack (3.1.1) lib/action_dispatch/middleware/cookies.rb:331:in `call' | |
activerecord (3.1.1) lib/active_record/query_cache.rb:62:in `call' | |
activerecord (3.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call' | |
actionpack (3.1.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' | |
activesupport (3.1.1) lib/active_support/callbacks.rb:392:in `_run_call_callbacks' | |
activesupport (3.1.1) lib/active_support/callbacks.rb:81:in `run_callbacks' | |
actionpack (3.1.1) lib/action_dispatch/middleware/callbacks.rb:28:in `call' | |
rack (1.3.5) lib/rack/sendfile.rb:101:in `call' | |
actionpack (3.1.1) lib/action_dispatch/middleware/remote_ip.rb:48:in `call' | |
actionpack (3.1.1) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call' | |
railties (3.1.1) lib/rails/rack/logger.rb:13:in `call' | |
rack (1.3.5) lib/rack/methodoverride.rb:24:in `call' | |
rack (1.3.5) lib/rack/runtime.rb:17:in `call' | |
activesupport (3.1.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call' | |
rack (1.3.5) lib/rack/lock.rb:15:in `call' | |
rack-cache (1.1) lib/rack/cache/context.rb:132:in `forward' | |
rack-cache (1.1) lib/rack/cache/context.rb:139:in `pass' | |
rack-cache (1.1) lib/rack/cache/context.rb:151:in `invalidate' | |
rack-cache (1.1) lib/rack/cache/context.rb:70:in `call!' | |
rack-cache (1.1) lib/rack/cache/context.rb:50:in `call' | |
railties (3.1.1) lib/rails/engine.rb:456:in `call' | |
railties (3.1.1) lib/rails/railtie/configurable.rb:30:in `method_missing' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb:205:in `start_request_handler' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb:170:in `block in handle_spawn_application' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb:479:in `safe_fork' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb:165:in `handle_spawn_application' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:180:in `start' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb:128:in `start' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize' | |
<internal:prelude>:10:in `synchronize' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously' | |
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/helper-scripts/passenger-spawn-server:99:in `<main>' |
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
module Support | |
class ProductsController < BaseController | |
before_filter :get_product_line | |
caches_action :show, :layout => false | |
def show | |
@product = @product_line.products.find(params[:id]) | |
#get the downloads for this product | |
@downloads = Download.get_by_product(@product.id) | |
end | |
private | |
def get_product_line | |
@product_line = ProductLine.find(params[:product_line_id]) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment