Can someone explain the use ! 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
This is just a logical not .
not
request.xhr? => true !request.xhr? => false
If you do not want to display the layout when the request comes from AJAX. then use :layout => !request.xhr?
:layout => !request.xhr?
Source: https://habr.com/ru/post/920389/More articles:Call a function without waiting for it - javaHow to "clear" WinAPI transparent window - c ++Rails, Geocoder and nearby - ruby | fooobar.comwhat is used in ruby? - syntaxconvert base64 String to bytecode in java - javaChanging the height of user inputView when turning the device - ios"ld: library not found for -lXYZ" means what? What are the different options? - iosprogrammatically find the size of a float - javaMagento: getting your own quote-position field for an order - orderHow to display a Toast message from a class that does not extend Activity - androidAll Articles