leogalmeida/slim-rails — Issue #20: Error: undefined local variable or method `templates' for Slim::Generators::ScaffoldGenerator:Class
Author: pferdefleisch
Created: 2012-02-07 10:49:09+00:00
State: open

Even after patching #17 I get this error in `rails 3.2.1`

```
[WARNING] Could not load generator "generators/slim/scaffold/scaffold_generator". Error: undefined local variable or method `templates' for Slim::Generators::ScaffoldGenerator:Class.
```
Buttloads of parens

```ruby
# lib/generators/slim/scaffold/scaffold_generator.rb

require 'rails/generators/erb/scaffold/scaffold_generator'

module Slim
module Generators
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
source_root File.expand_path(File.join('..', templates), __FILE__)

def copy_view_files
available_views.each do |view|
filename = filename_with_extensions view
template "#{view}.html.slim",
File.join('app', 'views', controller_file_path, filename)
end
end

hook_for :form_builder, :as => :scaffold

protected
def available_views
['index', 'edit', 'show', 'new', '_form']
end

def handler
:slim
end
end
end
end
```

This is happening with vanilla rails and also with inherited_resources