Reputation: 24560
Can some one please explain the usage !
in the following ruby example:
def show
@article = Article.find(params[:id])
respond_to do |format|
format.html { render :layout => ! request.xhr? }
end
end
thanks
Upvotes: 1
Views: 197
Reputation: 3739
If you don't want to render a layout when the request comes from AJAX. then use :layout => !request.xhr?
Upvotes: 3
Reputation: 4245
It's simply logical not
.
request.xhr?
=> true
!request.xhr?
=> false
Upvotes: 5