Reputation: 19
I am trying to render a templated under
public/index.html.erb
def public_index
@post = Post.all
render 'public/index'
end
Missing template public/index
I don't see anything wrong with it. Is public a reserved word or something?
Upvotes: 0
Views: 204
Reputation: 3449
You can do like this:
Add this, into your routes.rb file.
match '/index', :to => redirect('/index.html')
Update
In Rails 4, it should use "get", not "match":
get '/index', :to => redirect('/index.html')
Upvotes: 0
Reputation: 2040
Try
render :template => 'public/index'
If this will not help then try following ways
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"
Check http://guides.rubyonrails.org/layouts_and_rendering.html
Upvotes: 0