Difference between render :action and render :template
There is no difference.render :template => 'some/thing'
is the same as just render 'some/thing'
, as well as the same as render :action => 'thing'
if we are in the some
controller.
From Ruby On Rails guide;
render :edit
render :action => :edit
render 'edit'
render 'edit.html.erb'
render :action => 'edit'
render :action => 'edit.html.erb'
render 'books/edit'
render 'books/edit.html.erb'
render :template => 'books/edit'
render :template => 'books/edit.html.erb'
render '/path/to/rails/app/views/books/edit'
render '/path/to/rails/app/views/books/edit.html.erb'
render :file => '/path/to/rails/app/views/books/edit'
render :file => '/path/to/rails/app/views/books/edit.html.erb'
Previously, calling render "foo/bar"
in a controller action was equivalent to render file: "foo/bar"
. In Rails 4.2, this has been changed to mean render template: "foo/bar"
instead. If you need to render a file, please change your code to use the explicit form (render file: "foo/bar"
) instead.
http://guides.rubyonrails.org/4_2_release_notes.html#render-with-a-string-argument