Categories not working in production at heroku Rails 4 -


i new rails , still learning application's category function works in development not in production @ heroku appreciated.

in pins_controller.rb

def index     if params[:category].blank?       @pins = pin.all.order("created_at desc").paginate(page: params[:page], per_page: 50)     else       @category_id = category.find_by(name: params[:category]).id       @pins = pin.where(category_id: @category_id).order("created_at desc").paginate(page: params[:page], per_page: 20)     end    end 

associations have been made between models category.rb , pin.rb

categories created using 'rails console’

i added drop-down nav-bar 16 categories here code,

_header.html.erb  <li class="dropdown">   <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="fa fa-th"></span> categories<b class="caret"></b></a>   <ul class="dropdown-menu">     <% category.all.each |category| %>       <li><%= link_to category.name, pins_path(category: category.name) %></li>     <% end %>   </ul> </li> 

_form.html.erb

<div class="form-group">     <%= f.collection_select :category_id, category.all, :id, :name, {prompt: "select category"} %>   </div> 

this issue has been resolved, silly me had re-create categories in production @ heroku follows: $ heroku run rails console start console in production, $ category.connection establish connection, , it's time create categories category.create(name: "action") etc etc. working ! big mackenziechild @ unicasts.com


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -