*bug* regarding my partials helper function

21 views
Skip to first unread message

haywood

unread,
May 30, 2011, 5:37:53 PM5/30/11
to middleman-users
When I start up my mm-server and try to load the index page, or any
subsequent page I get slapped with this error

NoMethodError at /
undefined method `[]' for nil:NilClass
file: rendering.rb location: render line: 130

Backtrace (expand)

/Users/ryanhaywood/Desktop/web/middleman/portfolio/views/layout.haml
in evaluate_source
= partial 'footer'

This is the code for my helper function

helpers do
def partial(path, *locals)
pieces = path.split('/')
partial = '_' + pieces.pop
locals = locals.empty? ? nil : locals[0]
render(File.join(pieces.join('/'), partial), partial = true, locals)
end
end

I include it with haml like this
= partial 'footer'

The error goes away if I change the functions name, like from partial
to render_partial. I can then refresh the page and all works well,
partials are included throughout the site. But if I restart the
server, I get the same initial error, but again it goes away with a
function name change.

I also can not locate the "rendering.rb" file on my machine.

Any help is appreciated. Thanks!
Reply all
Reply to author
Forward
0 new messages