nex3/sass — Issue #256: Defining String#to_a seems to break Sass
Author: alexeymuranov
Created: 2012-01-23 21:25:42+00:00
State: open

This is not a big problem but a strange behavior i've decided to report. I think it is in `sass`, but could be in `sass-rails`.

If i define a custom `String#to_a` method, this seems to break Sass in Rails.

Steps to reproduce:

* Create a new rails 3.2 application.

* Create a controller:

```shell
$ rails generate controller Pages home
```

* Add to `app/controllers/pages_controller.rb`:

```ruby
class String
def to_a
chars.to_a
end
end
```

* Add to `app/assets/stylesheets/pages.css.scss`

```sass
$ab: #999;
$x: darken($ab, 10%);
```

(It is important that the `$ab` variable had at least 2 letters.)

* Start the server and go to http://localhost:3000/pages/home, there is an error:

```
ArgumentError in Pages#home

Showing /Volumes/Data/Users/alexey/Development/rails_tests/test_sass/app/views/layouts/application.html.erb where line #5 raised:

wrong number of arguments (2 for 1)
(in /Volumes/Data/Users/alexey/Development/rails_tests/test_sass/app/assets/stylesheets/pages.css.scss)
Extracted source (around line #5):

2:
3:

4:

TestSass

5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8:

```