This project is archived and is in readonly mode.
binary files are attempted to be pre compiled as erb
Reported by Roger | October 7th, 2008 @ 10:16 PM | in 2.x
With edge rails, I get the following error when trying to compile binary files which are in the views directory:
@filename="[...]/app/views/simplegrey2/original/grey2/din_mittle.swf"
Here's one I get [fatal]:
/Users/rogerpack/dev/ruby_186_installed/lib/ruby/1.8/erb.rb:469:in
scan': undefined method
empty?' for nil:NilClass
(NoMethodError)
from /Users/rogerpack/dev/ruby_186_installed/lib/ruby/1.8/erb.rb:525:in `compile'
from /Users/rogerpack/dev/ruby_186_installed/lib/ruby/1.8/erb.rb:692:in `initialize'
from /Users/rogerpack/dev/degreesearch/vendor/rails/actionpack/lib/action_view/template_handlers/erb.rb:51:in `new'
from /Users/rogerpack/dev/degreesearch/vendor/rails/actionpack/lib/action_view/template_handlers/erb.rb:51:in `compile'
from /Users/rogerpack/dev/degreesearch/vendor/rails/actionpack/lib/action_view/template_handler.rb:11:in `call'
from /Users/rogerpack/dev/degreesearch/vendor/rails/actionpack/lib/action_view/renderable.rb:21:in `_unmemoized_compiled_source'
from /Users/rogerpack/dev/degreesearch/vendor/rails/activesupport/lib/active_support/memoizable.rb:57:in `compiled_source'
from /Users/rogerpack/dev/degreesearch/vendor/rails/activesupport/lib/active_support/memoizable.rb:25:in `__send__'
from /Users/rogerpack/dev/degreesearch/vendor/rails/activesupport/lib/active_support/memoizable.rb:25:in `memoize_all'
from /Users/rogerpack/dev/degreesearch/vendor/rails/activesupport/lib/active_support/memoizable.rb:22:in `each'
from /Users/rogerpack/dev/degreesearch/vendor/rails/activesupport/lib/active_support/memoizable.rb:22:in `memoize_all'
...
Possible fix: rescue and ignore?
Comments and changes to this ticket
-
Roger October 10th, 2008 @ 07:47 PM
- Tag changed from bug, edge to bug, edge
--- a/actionpack/lib/action_view/template_handlers/erb.rb +++ b/actionpack/lib/action_view/template_handlers/erb.rb @@ -48,11 +48,14 @@ module ActionView
self.erb_trim_mode = '-' def compile(template)
-
begin src = ::ERB.new("<% __in_erb_template=true %>#{template.source}", nil, erb_trim_mode, '@output_buffer').src # Ruby 1.9 prepends an encoding to the source. However this is # useless because you can only set an encoding on the first line RUBY_VERSION >= '1.9' ? src.sub(/\A#coding:.*\n/, '') : src
-
rescue Exception
-
end
seems to be a temporary fix. Better might be to only erb compile .rhtml or .html.erb files :)
-
Tom Lea October 11th, 2008 @ 04:07 PM
Is there a good reason why you don't put this static content in /public/simplegrey2/original/grey2/din_mittle.swf
Putting it inside /app/views makes rails deal with it, putting it in public makes the web server deal with it.
Basically, if you don't need rails to handle it, stick it in public, otherwise you are wasting valuable mongrel/whatever time dealing with stuff that apache/nginx is better at shifting.
-
Roger October 11th, 2008 @ 06:53 PM
Nope. I was just pointing out a difference ["gotcha"] between 2.1 and edge. If it's a good gotcha then I guess leave it in there ? I'm not sure :)
-
Repository December 3rd, 2008 @ 04:57 PM
- State changed from new to resolved
(from [2fc6c7dd05b9481ed81fe19c8fc0cc7915868404]) Validate template extensions [#1187 state:resolved] http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
Referenced by
- 1187 binary files are attempted to be pre compiled as erb (from [2fc6c7dd05b9481ed81fe19c8fc0cc7915868404]) Validat...