用!在Ruby中

sim*_*imo 1 ruby ruby-on-rails-3

有人可以!在以下ruby示例中解释用法:

def show
    @article = Article.find(params[:id])

    respond_to do |format|
        format.html { render :layout => ! request.xhr? }
    end
end
Run Code Online (Sandbox Code Playgroud)

谢谢

Fle*_*oid 5

这很简单not.

request.xhr?
=> true

!request.xhr?
=> false
Run Code Online (Sandbox Code Playgroud)