Last active
August 29, 2015 14:16
-
-
Save ysinc88/bae416815491021ddf45 to your computer and use it in GitHub Desktop.
Simple show not working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product < ActiveRecord::Base | |
belongs_to :product_category | |
has_many :product_images | |
has_many :led_configurations | |
has_many :leds, through: :led_configurations | |
include FriendlyId | |
friendly_id :name, :use => [:slugged] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Admin::ProductsController < Admin::BaseAdminController | |
def show | |
@products = Product.all #this works | |
@product = Product.friendly.find(params[:id]) #this doesnt > returning nil | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://example.com/admin/products/600w-2wl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% @product.each do |p| %> | |
<tr> | |
<td><%= p.name %></td> | |
</tr> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment