Recently, I embarked on a new application development journey using rails 4.0. However, I've encountered an unexpected situation where every request is being processed as an ajax request. For instance, consider this link:
=link_to "View detail", product_detail_path(:seo_name => vp.product.seo_name, :vp_id => vp.id), :class => "btn btn-default"
When I click on the above link to navigate to the product detail path and inspect the controller code for the same link:
def show
@product = Product.find_by_seo_name(params[:id]) #here in params[:id] you will get seo_name of product
@other_variants = @product.variant_products.where("variant_products.id NOT IN (?)", @variant.id)
The issue arises when I visit the product show page by clicking the link mentioned earlier, as it seems to be processed as an ajax request. Upon examining the browser console, I notice the following line:
GET http://localhost:3000/products/product-1-tb002?vp_id=71
This behavior is consistent across other links in my application, both those that are intended to be ajax requests and those that should result in html responses. It's puzzling and I can't seem to pinpoint the root cause!
In the image below, I demonstrate clicking on the "view detail" button which leads me to the product show page. Notably, the link does not include "remote => true" attribute, yet it still triggers an ajax request.
https://i.sstatic.net/yBQpy.jpg