Delegation failed : Sinatra embedded in Rails app with Sass #245

guillaumerose opened this Issue Apr 16, 2011 · 2 comments


None yet
3 participants

When Sinatra is embedded in Rails, there is some issue with delegate and Sass. Developers from Sass report that as a Sinatra bug.


(__DELEGATE__):2:in `options'
(__DELEGATE__):2:in `send'
(__DELEGATE__):2:in `options'
sass (3.1.0.alpha.253) lib/sass/./sass/plugin.rb:80:in `update_stylesheets'
sass (3.1.0.alpha.253) lib/sass/./sass/plugin.rb:54:in `check_for_updates'
sass (3.1.0.alpha.253) lib/sass/./sass/plugin/rack.rb:51:in `call'

Issue from Sass

If trying to integrate Sinatra through Rack into your Rails 3 app, it will throw a wrong number of arguments error (0 for 1). This is because Sinatra overwrites (or delegates) the options variable. The bug occurs in the Sass::Plugin module:

def update_stylesheets(individual_files = [])
  return if options[:never_update]

A quick fix is to scope the options hash using Sass::Plugin.options:

def update_stylesheets(individual_files = [])
  return if Sass::Plugin.options[:never_update]

This worked for me so I could move forward. Hope this helps anyone else.

bensie commented Apr 16, 2011

I'm having the same issue.


rkh commented Apr 16, 2011

Yes, this is caused by Sinatra, but what should we do? This is by design. The Sinatra delegator (activated by require 'sinatra') defines Object#options. One possible solution would be to call super if no argument/block is given, but that is kinda hackish. I will give this some thought.

rkh was assigned Apr 17, 2011

rkh closed this in 53b5ccd Apr 17, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment