I tried the following code to render a partial
= render partial: 'movie_same', locals: { current: @movie }, collection: @movie.dvd.movies.order('scene')
But I get this error
NameError in Movies#show
Showing /Users/user/app/views/movies/_movie_same.html.haml where line #1 raised:
undefined local variable or method `locals' for #<#<Class:0x007fe713ba90a8>:0x007fe710f79a00>
The mention in the render file is just to locals[:current].
Any idea why I’m getting this error?
You do not need to use
locals[:current]in the partial. You just need to usecurrentas:localswill set it as local variable in the target partial. so it will be justcurrentThis is what is said from the doc