Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionView::TemplateError (undefined method `any?' for nil:NilClass) #365

Open
xian7 opened this issue Mar 1, 2013 · 11 comments
Open

ActionView::TemplateError (undefined method `any?' for nil:NilClass) #365

xian7 opened this issue Mar 1, 2013 · 11 comments

Comments

@xian7
Copy link

xian7 commented Mar 1, 2013

Summary: Clicking on "Sinppet Files" in a fresh new project results in a 500 "Application error."

Radiant Version: 1.1.3
Database: PostgreSQL 9.2
System: FreeBSD 8.3

Details:

  1. Follow generic installation instructions to create a fresh radiant project using postgresql.
  2. Setup the DB and confirm that it is working (I can run "script/console production" and call "Page.count" and get 0 as the result).
  3. Start the server in production mode.
  4. Login to the admin interface and navigate to the "Design" section.
  5. Click on "Snippet Files".
  6. Notice that you are now looking at a 500 error page.

Here is the exception from the production log file:

ActionView::TemplateError (undefined method `any?' for nil:NilClass) on line #12 of /usr/local/lib/ruby/gems/1.8/gems/radiant-snippets-extension-1.1.1/app/views/admin/snippet_files/index.html.haml:
9:           - thead.title_header do
10:             %th.name= t('snippet')
11:     %tbody
12:       - if @snippet_files.any?
13:         - @snippet_files.each do |snippet|
14:           %tr[snippet]
15:             - render_region :tbody, :locals => {:snippet => snippet} do |tbody|

    /usr/local/lib/ruby/gems/1.8/gems/radiant-snippets-extension-1.1.1/app/views/admin/snippet_files/index.html.haml:12:in `_run_haml_47usr47local47lib47ruby47gems47146847gems47radiant45snippets45extension45146146147app47views47admin47snippet_files47index46html46haml'
    haml (3.1.8) rails/./lib/haml/helpers/action_view_mods.rb:13:in `render'
    haml (3.1.8) rails/./lib/haml/helpers/action_view_mods.rb:13:in `render'
    radiant (1.1.3) lib/radiant/resource_responses.rb:18:in `response_for'
    radiant (1.1.3) app/controllers/admin/resource_controller.rb:47:in `index'
    /usr/local/lib/ruby/gems/1.8/gems/compass-rails-1.0.3/lib/compass-rails/railties/2_3.rb:9:in `process'
    sass (3.2.6) lib/sass/./sass/plugin/rack.rb:54:in `call'

Thoughts: So, yeah... @snippet_files is nil when it is probably expected to be an empty enumeration.

@saturnflyer
Copy link
Member

thanks for reporting this!

@Linutux
Copy link
Member

Linutux commented Aug 28, 2013

I have the same error. production.log says:

Processing Admin::SnippetFilesController#index (for 79.235.83.126 at 2013-08-28 17:40:57) [GET]
  Parameters: {"controller"=>"admin/snippet_files", "action"=>"index"}
Rendering template within layouts/application
Rendering admin/snippet_files/index

ActionView::TemplateError (undefined method `any?' for nil:NilClass) on line #12 of /usr/local/rvm/gems/ruby-1.9.3-p448@meine-domain/gems/radiant-snippets-extension-1.1.1/app/views/admin/snippet_files/index.html.haml:
9:           - thead.title_header do
10:             %th.name= t('snippet')
11:     %tbody
12:       - if @snippet_files.any?
13:         - @snippet_files.each do |snippet|
14:           %tr[snippet]
15:             - render_region :tbody, :locals => {:snippet => snippet} do |tbody|

    /usr/local/rvm/gems/ruby-1.9.3-p448@meine-domain/gems/radiant-snippets-extension-1.1.1/app/views/admin/snippet_files/index.html.haml:12:in `_run_haml_47usr47local47rvm47gems47ruby45146946345p44864einfacher45studieren47gems47radiant45snippets45extension45146146147app47views47admin47snippet_files47index46html46haml'
    haml (3.1.8) lib/haml/helpers/action_view_mods.rb:13:in `render_with_haml'
    haml (3.1.8) lib/haml/helpers/action_view_mods.rb:13:in `render_with_haml'
    radiant (1.1.3) lib/radiant/resource_responses.rb:18:in `response_for'
    radiant (1.1.3) app/controllers/admin/resource_controller.rb:47:in `index'
    /usr/local/rvm/gems/ruby-1.9.3-p448@meine-domain/gems/compass-rails-1.0.3/lib/compass-rails/railties/2_3.rb:9:in `process_with_compass'
    sass (3.2.10) lib/sass/plugin/rack.rb:54:in `call'
    <internal:prelude>:10:in `synchronize'
    passenger (4.0.14) lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
    passenger (4.0.14) lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
    passenger (4.0.14) lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
    passenger (4.0.14) lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'

Rendering /var/customers/webs/rvmuser/meine-domain-de/public/500.html (500 Internal Server Error)

@saturnflyer
Copy link
Member

I just pushed up a new gem which should fix this: bundle update radiant-snippets-extension

@Linutux
Copy link
Member

Linutux commented Aug 28, 2013

Thanks for fixing it so quick!

I did "bundle update" but now I can't start it:

Config definition error: 'defaults.snippet.filter' is defined twice:
1. /usr/local/rvm/gems/ruby-1.9.3-p448@meine-domain/gems/radiant-snippets-extension-1.1.2/config/initializers/radiant_config.rb:2:in `block in <top (required)>'
2. /usr/local/rvm/gems/ruby-1.9.3-p448@meine-domain/gems/radiant-1.1.3/config/initializers/radiant_config.rb:10:in `block in <top (required)>'
         (LoadError)
  /usr/local/rvm/gems/ruby-1.9.3-p448@meine-domain/gems/radiant-1.1.3/app/models/radiant/config.rb:192:in `define'
[.....]

What did I wrong?

@saturnflyer saturnflyer reopened this Aug 28, 2013
@jomz
Copy link
Member

jomz commented Aug 28, 2013

You did nothing wrong. I removed that config setting from radiant core on the master branch because it did not belong there. We should probably backport that and release 1.1.4

@jomz
Copy link
Member

jomz commented Aug 28, 2013

I just merged the commit that removes this config entry from core into the 1.1.3 branch;
2049684

@Linutux
Copy link
Member

Linutux commented Aug 29, 2013

@jomz
Did you also update the gem on rubygems?

@jomz
Copy link
Member

jomz commented Aug 30, 2013

No, not yet, there's a failing spec I'd like to fix first.
I'll try to release today.

@jomz
Copy link
Member

jomz commented Aug 30, 2013

Fixed and pushed. @saturnflyer could you build and release 1.1.4? This issue can be closed then.

@jomz
Copy link
Member

jomz commented Aug 30, 2013

@saturnflyer scrap that, Travis failed on the 1.x branch, investigating.

@saturnflyer
Copy link
Member

While we get radiant fixed up and the specs running for a new release, I pushed up a new version of radiant-snippets-extension.
Update your Gemfile to use version 1.1.3 and you should be ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants