chriseppstein/compass — Issue #661: image_height causes undefined local variable or method `options' error
Author: billsaysthis
Created: 2012-01-01 20:28:39+00:00
State: open

Using Rails 3.1 and asset pipeline with Compass 0.12.alpha3 in Gemfile gets an error using the image_height function (in application_helper.rb):

````
undefined local variable or method `options' for #<#:0x007ff1de44bdd0>
````

Calling code is:

````
module ApplicationHelper
include Compass::SassExtensions::Functions::ImageSize

def member_image_link(user)
if user.has_logo?
# error is on next line
ih = image_height(Sass::Script::String.new(user.m_logo))
ic = (ih.to_i > 115) ? 'logoHT' : 'logoWD'
link_to image_tag(user.m_logo, :alt => user.name), user.url, :class => ic
end
end
````

Stack trace

````
compass (0.12.alpha.3) lib/compass/sass_extensions/functions/image_size.rb:48:in `image_dimensions'
compass (0.12.alpha.3) lib/compass/sass_extensions/functions/image_size.rb:10:in `image_height'
app/helpers/application_helper.rb:17:in `member_image_link'
app/views/layouts/_sponsor.html.haml:3:in `_app_views_layouts__sponsor_html_haml___2629449523552851706_70100096542420'
actionpack (3.1.3) lib/action_view/template.rb:171:in `block in render'
activesupport (3.1.3) lib/active_support/notifications.rb:55:in `instrument'
actionpack (3.1.3) lib/action_view/template.rb:169:in `render'
actionpack (3.1.3) lib/action_view/renderer/partial_renderer.rb:256:in `render_partial'
actionpack (3.1.3) lib/action_view/renderer/partial_renderer.rb:228:in `block (2 levels) in render'
actionpack (3.1.3) lib/action_view/renderer/abstract_renderer.rb:33:in `block in instrument'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `block in instrument'
activesupport (3.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `instrument'
actionpack (3.1.3) lib/action_view/renderer/abstract_renderer.rb:33:in `instrument'
actionpack (3.1.3) lib/action_view/renderer/partial_renderer.rb:227:in `block in render'
actionpack (3.1.3) lib/action_view/renderer/abstract_renderer.rb:22:in `wrap_formats'
actionpack (3.1.3) lib/action_view/renderer/partial_renderer.rb:219:in `render'
actionpack (3.1.3) lib/action_view/renderer/renderer.rb:41:in `render_partial'
actionpack (3.1.3) lib/action_view/renderer/renderer.rb:15:in `render'
actionpack (3.1.3) lib/action_view/helpers/rendering_helper.rb:24:in `render'
haml (3.2.0.alpha.8) lib/haml/helpers/action_view_mods.rb:11:in `block in render_with_haml'
haml (3.2.0.alpha.8) lib/haml/helpers.rb:90:in `non_haml'
haml (3.2.0.alpha.8) lib/haml/helpers/action_view_mods.rb:11:in `render_with_haml'
app/views/layouts/_sponsors_block.html.haml:5:in `block in _app_views_layouts__sponsors_block_html_haml___3927890801332545063_70100100649460'
app/views/layouts/_sponsors_block.html.haml:4:in `each'
app/views/layouts/_sponsors_block.html.haml:4:in `_app_views_layouts__sponsors_block_html_haml___3927890801332545063_70100100649460'
actionpack (3.1.3) lib/action_view/template.rb:171:in `block in render'
activesupport (3.1.3) lib/active_support/notifications.rb:55:in `instrument'
actionpack (3.1.3) lib/action_view/template.rb:169:in `render'
actionpack (3.1.3) lib/action_view/renderer/partial_renderer.rb:256:in `render_partial'
actionpack (3.1.3) lib/action_view/renderer/partial_renderer.rb:228:in `block (2 levels) in render'
actionpack (3.1.3) lib/action_view/renderer/abstract_renderer.rb:33:in `block in instrument'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `block in instrument'
activesupport (3.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `instrument'
actionpack (3.1.3) lib/action_view/renderer/abstract_renderer.rb:33:in `instrument'
actionpack (3.1.3) lib/action_view/renderer/partial_renderer.rb:227:in `block in render'
actionpack (3.1.3) lib/action_view/renderer/abstract_renderer.rb:22:in `wrap_formats'
actionpack (3.1.3) lib/action_view/renderer/partial_renderer.rb:219:in `render'
actionpack (3.1.3) lib/action_view/renderer/renderer.rb:41:in `render_partial'
actionpack (3.1.3) lib/action_view/renderer/renderer.rb:15:in `render'
actionpack (3.1.3) lib/action_view/helpers/rendering_helper.rb:24:in `render'
haml (3.2.0.alpha.8) lib/haml/helpers/action_view_mods.rb:11:in `block in render_with_haml'
haml (3.2.0.alpha.8) lib/haml/helpers.rb:90:in `non_haml'
haml (3.2.0.alpha.8) lib/haml/helpers/action_view_mods.rb:11:in `render_with_haml'
app/views/layouts/application.html.haml:27:in `_app_views_layouts_application_html_haml___522401710123117189_70100077237680'
actionpack (3.1.3) lib/action_view/template.rb:171:in `block in render'
activesupport (3.1.3) lib/active_support/notifications.rb:55:in `instrument'
actionpack (3.1.3) lib/action_view/template.rb:169:in `render'
actionpack (3.1.3) lib/action_view/renderer/template_renderer.rb:52:in `render_with_layout'
actionpack (3.1.3) lib/action_view/renderer/template_renderer.rb:38:in `render_template'
actionpack (3.1.3) lib/action_view/renderer/template_renderer.rb:12:in `block in render'
actionpack (3.1.3) lib/action_view/renderer/abstract_renderer.rb:22:in `wrap_formats'
actionpack (3.1.3) lib/action_view/renderer/template_renderer.rb:9:in `render'
actionpack (3.1.3) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.1.3) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.1.3) lib/abstract_controller/rendering.rb:120:in `_render_template'
actionpack (3.1.3) lib/action_controller/metal/streaming.rb:250:in `_render_template'
actionpack (3.1.3) lib/abstract_controller/rendering.rb:114:in `render_to_body'
actionpack (3.1.3) lib/action_controller/metal/renderers.rb:30:in `render_to_body'
actionpack (3.1.3) lib/action_controller/metal/compatibility.rb:43:in `render_to_body'
actionpack (3.1.3) lib/abstract_controller/rendering.rb:99:in `render'
actionpack (3.1.3) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.1.3) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/Users/billlazar/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (3.1.3) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:78:in `cleanup_view_runtime'
activerecord (3.1.3) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:39:in `render'
remotipart (1.0.1) lib/remotipart/render_overrides.rb:7:in `render'
actionpack (3.1.3) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.1.3) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.1.3) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.1.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.1.3) lib/active_support/callbacks.rb:434:in `_run__3532465482595399818__process_action__4207005106788134790__callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:386:in `_run_process_action_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `block in instrument'
activesupport (3.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `instrument'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/params_wrapper.rb:201:in `process_action'
activerecord (3.1.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.1.3) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.1.3) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.1.3) lib/action_controller/metal.rb:193:in `dispatch'
actionpack (3.1.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.1.3) lib/action_controller/metal.rb:236:in `block in action'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:in `call'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:in `dispatch'
actionpack (3.1.3) 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:89: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.3) lib/action_dispatch/routing/route_set.rb:532:in `call'
rack-pjax (0.5.5) lib/rack/pjax.rb:12:in `call'
warden (1.1.0) lib/warden/manager.rb:35:in `block in call'
warden (1.1.0) lib/warden/manager.rb:34:in `catch'
warden (1.1.0) lib/warden/manager.rb:34:in `call'
actionpack (3.1.3) 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:25:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/head.rb:14:in `call'
remotipart (1.0.1) lib/remotipart/middleware.rb:30:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/flash.rb:247: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.3) lib/action_dispatch/middleware/cookies.rb:331:in `call'
activerecord (3.1.3) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (3.1.3) lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/reloader.rb:68:in `call'
rack (1.3.5) lib/rack/sendfile.rb:101:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.1.3) 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.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.5) lib/rack/lock.rb:15:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.1.3) lib/rails/engine.rb:456:in `call'
railties (3.1.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/billlazar/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:146:in `handle'
/Users/billlazar/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:99:in `rescue in block (2 levels) in start'
/Users/billlazar/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:96:in `block (2 levels) in start'
/Users/billlazar/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:86:in `each'
/Users/billlazar/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:86:in `block in start'
/Users/billlazar/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:66:in `loop'
/Users/billlazar/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:66:in `start'
/Users/billlazar/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:13:in `run'
/Users/billlazar/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/bin/nack_worker:4:in `

'
````

Same code works correctly in Rails 3.0.11.