I've got a Product
model.
How do I get the url of a product in Rails 3, in a controller.
For example (pseudo code):
def foobar @product = Product.first puts @product.url end
Is such a thing possible?
Assuming the Product
model is mapped as :resources in your routes.rb
file:
def foobar @product = Product.first url = product_url(@product) end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With