def some_action
@posts = Post.all
render partial: 'layouts/things'
end
In my layouts directory I have things as partial (_things.html.erb
)
My other partials work fine. But it doesn't render partial throwing exception as
Missing partial layouts/things with {:locale=>[:en], :formats=>[:json], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Searched in: * "/my/path/appname/app/views"
Edit-1
def some_action
@posts = Post.all
respond_to do |format|
format.json
end
end
Ok i changed my controller link this but then too same exception.
Edit-2
I have created in my views/controller_name/_some_action.json.erb
This is the controller
def some_action
@posts = Post.all
respond_to do |format|
format.json { render json: @posts }
end
end
My _some_action.json.erb file has
<%= render partial: 'shared/information', post: @posts.name %>
And created _information..js.erb
in views shared directory
MY _information.js.erb has sample text as
test
I am getting json response from controller i checked with inspect element. But it is not render actual text i need (i.e., test
)