问题
This is the code i have
<a <%= link_to "open your box", gig_path(@gig), class: "mcnButton", target: "_blank", style: "font-weight: bold;letter-spacing: 0px;line-height: 100%;text-align: center;text-decoration: none;color: #FFFFFF;"%></a>
from the above <%= link_to "open your box", gig_path(@gig)
Note gig_path(@gig) it gives me the url http://gigs/3,and it works well,it found the gig i need with id:3 the problem is that it doesn't provide the full url like this
http://example.com/gigs/3
P.S. for reference i can do @gig.title,@gig.description and it works with no problem.
回答1:
To get the full URL, use gig_url(@gig) instead of gig_path(@gig).
来源:https://stackoverflow.com/questions/30606747/how-to-link-to-full-path-in-rails-4