I am not able for some reason to pass local variables to the show view...
In my controller i have simply:
def show
render template: \"books/show\", :re
First I am wondering why would you need the template:
. Are you on Rails 2.x? If not, then the :template
option is no longer required. You should be able to get along fine with just
render "books/show"
Second do you need to specify the template? What is the controller you want to render from? If that's BooksController
, then you don't need the template path either, which makes the line being just
render
That's without the variables yet. Now, I just checked, and a simple:
render locals: { resource: "Some text" }
as well as:
render 'books/show', locals: { resource: "Some text" }
works for me just fine. Maybe earlier Rails versions treated 'resource' as some kind of a keyword? Don't know, but the above Worksforme™ in both forms.