ruby 有没有办法绕过 application.html.erb 但仍然使用控制器的相应视图?
现在我有
render :layout => false
但我从视图中得到以下错误:
undefined method `each' for nil:NilClass
以下是我当前的帖子控制器:
class PostsController < ApplicationController
def index
@posts = Post.where('is_deleted' => false, 'is_hidden' => false).limit(15).order('created_at DESC')
end
def show
@posts = Post.find(params[:id], :conditions => 'is_deleted = false')
end
def page
render :layout => false
@posts = Post.where('is_deleted' => false, 'is_hidden' => false).limit(15).offset(params[:page].to_i * 15).order('created_at DESC')
end
end