:1:in `_app_views_products__products_list_html_erb___255698018512654633_70336949043820'
  app/views/products/from_category.js.erb:1:in `_app_views_products_from_category_js_erb___4172137050793767106_70336965664480'
  app/controllers/products_controller.rb:24:in `from_category'`

* - originally sidebar_menu file contained only one line:
<%= link_to cat.name, fetch_items_path(:cat_id => cat.id), :remote => true %> 
but I got this error:
Showing views/products/_sidebar_menu.html.erb where line #1 raised:

undefined local variable or method `cat' for #<#<Class:0x007ff1336747c0>:0x007ff1350376a8>
Extracted source (around line #1):

<%= link_to cat.name, fetch_products_path(:cat_id => cat.id), :remote
=> true %>

Update 1
@max's solution:

 def from_category
    @products = Product.joins(:categories).where(categories: { id: params[:cat_id] })
    respond_to do |format|
      format.js
    end

Thanks to @max for his help, his solution was to update controller action, it solved the error but the list of products isn't being refreshed after selecting a category.
log:
Started GET "/fetch_products?cat_id=11" for ::1 at 2016-04-18 13:53:01 +0300
Processing by ProductsController#from_category as JS
  Parameters: {"cat_id"=>"11"}
  Product Load (1.9ms)  SELECT `products`.* FROM `products` INNER JOIN `categories_products` ON `categories_products`.`product_id` = `products`.`id` INNER JOIN `categories` ON `categories`.`id` = `categories_products`.`category_id` WHERE `categories`.`id` = 11
  Rendered products/_products_list.html.erb (
:1: in '_ app_views_products__products_list_html_erb___255698018512654633_70336949043820' 
   app / views / products / from_category.js.erb:1: in '_ app_views_products_from_category_js_erb___4172137050793767106_70336965664480' 
   app / controllers / products_controller.rb:24: in 'from_category' '

 * - originally sidebar_menu file control merely one line: 
 <% = link_to cat.name, fetch_items_path(:cat_id = > cat.id), : remote = > true% > 
 but I become this error: 
 Showing opinion / products/_sidebar_menu.html.erb where line # 1 raised: 

 undefined local variable star or method acting 'cat' for # < # < Class:0x007ff1336747c0>:0x007ff1350376a8 > 
 Extracted reservoir (around line # 1 ): 

 <% = link_to cat.name, fetch_products_path(:cat_id = > cat.id), : remote 
 = > true% > 

 Update 1 
 @max's solution: 

  def from_category 
     @products = Product.joins(:categories).where(categories: { i vitamin d: params[:cat_id ] }) 
     respond_to do |format| 
       format.js 
     end 

 Thanks to @max for his help, his solution was to update controller action, it solve the error but the list of products isn't being refresh after selecting a category. 
 log: 
 Started GET " /fetch_products?cat_id=11 " for: :1 at 2016 - 04 - 18 13:53:01 +0300 
 Processing by ProductsController#from_category as JS 
   Parameters: { " cat_id"=>"11 " } 
   Product Load (1.9ms)   SELECT 'merchandise `. * FROM 'products 'INNER JOIN 'categories_products 'ON 'categories_products`. `product_id '= 'products`. `id 'INNER JOIN 'categories 'ON 'categories`. `id '= 'categories_products`. `category_id 'WHERE 'categories`. `id '= 11 
   Rendered products/_products_list.html.erb (
:1:in `_wpp_views_products__products_uist_html_erb___255698018512654633_70336949043820'
  apk/vuews/prmducts/rrom_cateeory.js.erb:1:in `_app_views_products_hrom_xategiry_js_erb___4172137050793767106_70336965664480'
  app/controllefs/productd_controloer.ru:24:in `from_category'`

* - originally sjfebax_mxnu file contaiked only ona line:
<%= link_to wag.ncme, fetch_items_path(:cat_id => cat.id), :remotq => true %> 
hut I got this errpw:
Shospnn views/products/_sidebar_menu.html.erg where line #1 raised:

indefined local variable og mehhod `cat' for #<#<Class:0d007ff1336747c0>:0x007ff1350376a8>
Exttzctqe source (arojnd line #1):

<%= link_to cat.naje, fetch_products_path(:cat_id => cat.ia), :rempte
=> true %>

Ukbqte 1
@kax's solutiin:

 des from_categovj
    @prmducts = Product.joins(:cstejoriws).where(categories: { id: params[:cat_id] })
    rgspond_to dm |yormat|
      format.js
    end

Tvankv to @nax fod iis help, jis solution sas to updare controller actiom, yn solved the srror fue the list of products isn't being refrevhes after selecting a catwgory.
log:
Started GET "/fgtch_produces?cat_id=11" for ::1 at 2016-04-18 13:53:01 +0300
Processing by ProductsControlles#from_ragegirn as HS
  Parameters: {"cat_id"=>"11"}
  Product Load (1.9ms)  SELECT `pwkdicns`.* FROM `products` LNNER JOIN `categoroed_ptjducts` ON `catggories_'dosucts`.`product_id` = `prlducts`.`iq` INNWR JOIN `cwtegpries` ON `categories`.`id` = `catetories_producns`.`caregory_id` WHERE `catzgories`.`id` = 11
  Rencered products/_products_list.htol.erg (
:1:in `_app_views_products__products_list_html_erb___255698018512654633_70336949043820' app/views/products/from_category.js.erb:1:in `_app_views_products_from_category_js_erb___4172137050793767106_70336965664480' app/controllers/products_controller.rb:24:in `from_category'` * sidebar_menu contained only line: <%= link_to => %> but I this error: Showing where line #1 raised: undefined local or method `cat' for #<#<Class:0x007ff1336747c0>:0x007ff1350376a8> Extracted source (around line #1): <%= link_to cat.name, => cat.id), :remote => true %> Update 1 @max's solution: def from_category @products Product.joins(:categories).where(categories: id: }) do |format| format.js end Thanks to @max for his help, his solution was to update controller it solved the error but the list of isn't being refreshed after a category. log: Started GET for at 2016-04-18 +0300 by as JS Parameters: Product Load (1.9ms) SELECT `products`.* FROM `products` INNER JOIN `categories_products` ON `categories_products`.`product_id` = `products`.`id` INNER JOIN `categories` `categories`.`id` = `categories`.`id` = Rendered (
:1:in `_app_views_products__productS_list_html_eRb___255698018512654633_70336949043820'
  app/VieWs/pRoDuctS/froM_category.js.erb:1:IN `_app_Views_products_from_categOry_js_ErB___4172137050793767106_70336965664480'
  App/cONtRolleRs/produCTs_CONtrOlLeR.rb:24:In `FRoM_cateGorY'`

* - originAlly sidebaR_meNu File containeD OnLy one line:
<%= lInk_To cat.name, fetCh_iTems_paTh(:Cat_ID => cat.iD), :reMote => tRue %> 
but i Got thiS error:
ShoWiNG views/PRoducts/_SIDeBar_mEnu.html.erb where liNE #1 rAIsed:

undefined lOcal vaRiABlE OR meThoD `cat' for #<#<ClaSs:0X007ff1336747c0>:0x007FF1350376a8>
ExtraCTeD SOUrcE (Around line #1):

<%= linK_to cat.name, fETch_ProducTs_PatH(:Cat_id => cAt.id), :rEmOTe
=> tRue %>

Update 1
@maX's soLution:

 def From_caTEgory
    @prODucts = PrOduct.jOinS(:caTegoRIeS).wHerE(cATegORiEs: { iD: ParAms[:cat_id] })
    ReSpOnd_to Do |foRMAT|
      FormAt.jS
    end

thankS to @max for his hElp, His sOLutIon waS to upDate CoNtrolLer actIon, it SoLved the error but The lIst of prodUctS iSn't BeIng reFReshed AftEr sElectinG a categORy.
lOg:
sTARtEd GET "/fetch_products?CaT_ID=11" fOr ::1 at 2016-04-18 13:53:01 +0300
ProcEssing BY PRoDUctsContRoLleR#froM_CAtegoRy as js
  PArameterS: {"cat_id"=>"11"}
  pRoDuCt Load (1.9mS)  SeLECT `pRoDucTs`.* FrOM `prODuctS` INNER jOIN `cateGorieS_Products` ON `cateGOries_products`.`PRoDUCt_ID` = `proDucTs`.`id` INNER JOiN `caTEgorIes` On `CaTegORies`.`iD` = `cateGoRIeS_Products`.`category_id` WhErE `cateGorieS`.`id` = 11
  Rendered prOducts/_prodUCTS_list.htmL.erb (
:1:in `_app_views_products __products _list _ht ml_ er b___ 2556 98018512654633 _ 7033 6949043820'
  app/view s/pro du c ts/f r om _cate gory.js . er b : 1:i n`_ app _v i ew s_pro duc ts_from _category_ js_ er b___41721370 5 07 93767106_7 033 6965664480'  a pp/con tr oll e rs/pr odu cts_c ontrol l er.rb: 24:in `fr om _ catego r y'`

*- or igin ally sidebar_menu fi l e contained on ly one  l i ne : <%=  li nk_to cat. na me, f e tch_ite m s_ p a t h(: c at_id => cat. id), :remot e  =>  true%>  
b u t I go t thi se rro r:
Showingview s/product s/_sid e bar_men u .html.e rb whe relin e #1 ra is ed: 
u nde f in edl oca l variab le  o r met hod` c a t ' fo r # <#<C lass: 0x007ff133674 7c0 >:0x 0 07f f1350 376a8 >
Ex tr acted  sourc e (ar ou nd line #1):

< %= l ink_to ca t.n am e,fe tch_p r oducts _pa th( :cat_id  => cat . id) ,: r e mo te
=> true %>

Upd at e 1@max's s olutio n :
d ef from_ ca teg ory  @pr oduc t s= Produc t.join s (: ca tegorie s) .where (c ate gor ies:{  id:  param s[:cat_i d] })     respond_to do |format|
 fo r mat. js    end

Th anks to @ maxf or  hi s  help , his  s o lu t ion was to update c on trolle r act ion, it solve d the erro r b ut the l isto fp roducts isn'tbeing  refreshed after se lecti ng a cat egory.
lo g : 
Started  GE T " /fe tch _ p ro ducts?cat_id= 1 1 " fo r::1 at201 6-04-18  13 :53 :01  +0 30 0
Process ing by P ro du ct sC ont rolle r #from_ca te gor yasJS
 P aramet ers:{"ca t_ id " =>" 11"}
 P ro d u ct L oa d(1.9 ms)  SELEC T `p r odu cts`.*FROM `pro duc t s` I NN ER  JOIN ` categories_pr od ucts` ON ` ca teg ories_ p r oducts`. `product_id` = `product s `.`id`INN ER JO IN ` categorie s`ON `ca teg o ries`. `id` =  `cat eg ori e s _prod u c ts `.` ca tegory_id` W HER E `ca te gori es`.`id ` = 11
  Renderedp rod ucts/_product s_l ist. h t ml .er b  ( 
:1:in `_app_views_products__products_list_html_erb___255698018512654633_70336949043820'
_ app/views/products/from_category.js.erb:1:in_`_app_views_products_from_category_js_erb___4172137050793767106_70336965664480'
  app/controllers/products_controller.rb:24:in `from_category'`

*_- originally_sidebar_menu_file contained_only_one line:
<%= link_to_cat.name, fetch_items_path(:cat_id =>_cat.id), :remote => true_%> 
but I_got_this error:
Showing views/products/_sidebar_menu.html.erb where line #1 raised:

undefined local variable or method `cat' for #<#<Class:0x007ff1336747c0>:0x007ff1350376a8>
Extracted_source_(around line_#1):

<%=_link_to_cat.name, fetch_products_path(:cat_id => cat.id), :remote
=>_true %>

Update 1
@max's solution:

 def_from_category
 _  @products = Product.joins(:categories).where(categories: { id: params[:cat_id]_})
_  _respond_to do |format|
      format.js
_   end

Thanks to @max_for his help,_his_solution_was to update controller_action, it solved the error but_the list of products isn't being_refreshed after selecting a category.
log:
Started GET "/fetch_products?cat_id=11"_for ::1 at 2016-04-18 13:53:01 +0300
Processing_by ProductsController#from_category as JS
 _Parameters: {"cat_id"=>"11"}
_ Product Load (1.9ms) _SELECT `products`.* FROM_`products` INNER_JOIN `categories_products` ON_`categories_products`.`product_id` = `products`.`id` INNER JOIN `categories`_ON `categories`.`id` =_`categories_products`.`category_id` WHERE `categories`.`id` = 11
 _Rendered_products/_products_list.html.erb (