I'm new to RoR. I am reading Agile Development etc. and I have
completed a tutorial that explains the differences between rails 2.0
and rails 2.1.
Still some questions are unanswered by the book. I hope you can help
me with the most intriguing one:
I have created a scaffold for model 'movie'. After some iterations I
have manually added a admin controller with views.
It appears that the image-links from the movie-view result in a get
from the image in the directory public/images, whereas the image links
from the admin views get the images another place.
Can you explain WHY this happens and what I can do to p be able to
- use public/images in both cases
- use the same subdirectory of a view directory in both cases?
Is a *relative path*. You should be able to use an absolute path "/
images/..." which will be absolute with respect to your Rails
application.
Yes, that is true. It IS relative. I am going to implement a helper
function as you suggested. That is much better.
But I still would like to know why movie.one_sheet_url() gives me
another result when called from two different locations
(in this case views/movies/index.html.erb and views/ and
views/login/list_movies.html.erb)
Rails has so much magic going on that a newbie like me gets a bit
dizzy.
It's probably also worth mentioning that, if you're storing images in
the standard /public/images folder, you can use a rails helper: