1

Whats is the difference between

render partial: 'shared/errors', locals: { errors: @project.errors }

and

render 'shared/errors', errors: @project.errors

when rendering a partial shared/_errors.rb?

Deepak Mahakale
  • 22,834
  • 10
  • 68
  • 88
JonSayer
  • 181
  • 1
  • 16
  • 4
    See: http://stackoverflow.com/questions/4402556/rails-confused-about-syntax-for-passing-locals-to-partials?rq=1 – Gokul Nov 16 '16 at 09:37

1 Answers1

1

They both seem to be doing exact same thing, but in some cases you have to explicitly specify render partial: '...' if you want to use certain options such as :layout, :collection etc.

As stated here: http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials

Kingsley Ijomah
  • 3,273
  • 33
  • 25