ruby on rails - Some contents is not showing in production mode -
i have created simple blog using rails, works fine in development environment not working in production environment. deployed app in heroku. content not showing in production mode. following code used categories/index
<h1>categories</h1> <% @category.each |cat|%> <ul> <li> <%= link_to cat.title, {:action => 'show', :id => cat.id} %> </li> </ul> <%end%>
also when go developer tools in browser heading categories showing , li not showing in development mode showing in developer tools on browser. have no idea do. in advance.
i've had problem before, it's caused your heroku database having no data in it.
the way resolve use database "seeding":
#db/seed.rb categories = %w(cat1 cat2 cat3) categories.each |category| category.find_or_create_by(name: category) end $ git add . $ git commit -a -m "categories" $ git push heroku master $ heroku run rake db:seed
Comments
Post a Comment