Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

binary files are attempted to be pre compiled as erb

#1187

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 methodempty?' 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?

Reported by Roger · October 7th, 2008 @ 10:16 PM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Roger
    Roger
    • 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
      
      
      end end end

    seems to be a temporary fix. Better might be to only erb compile .rhtml or .html.erb files :)

    October 10th, 2008 @ 07:47 PM

  2. Tom Lea
    Tom Lea

    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.

    October 11th, 2008 @ 04:07 PM

  3. Roger
    Roger

    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 :)

    October 11th, 2008 @ 06:53 PM

  4. Repository
    Repository
    • State changed from new to resolved

    (from [2fc6c7dd05b9481ed81fe19c8fc0cc7915868404]) Validate template extensions [#1187 binary files are attempted to be pre compiled as erb state:resolved] http://github.com/rails/rails/co...

    December 3rd, 2008 @ 04:57 PM