Forum: Ruby on Rails file_column mangling URL

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B0e227ae419295321ca2aff4c27ad99d?d=identicon&s=25 Nic Werner (Guest)
on 2006-01-17 02:01
(Received via mailing list)
Hey,

  I've gotten file_column to upload a file, drop it in the dynamic
directory, but I can't display the image, the directories repeat
themselves:

My model:

class Person < ActiveRecord::Base
	file_column	 :image_url

In my view:

<%= image_tag url_for_file_column('person', 'image_url') %>

HTML generated is this:

<img alt="Male_face"
src="/dhcp/public/dhcp/public/person/image_url/3/male_face.jpg" />

There shouldn't be two '/dhcp/public' there.

--
- Nic
4bd34a2216dc8bdbf1f017f64e4d59e8?d=identicon&s=25 Kyle Maxwell (Guest)
on 2006-01-17 03:07
(Received via mailing list)
On 1/16/06, Nic Werner <nicwerner@gmail.com> wrote:
>
>
> --
> - Nic
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>

I know that with the addition of named routes, Rails uses xxxx_url,
and possibly either reserves it, or attaches magic functionality.
What happens when you rename your field?

--
Kyle Maxwell
Chief Technologist
E Factor Media // FN Interactive
kyle@efactormedia.com
1-866-263-3261
B0e227ae419295321ca2aff4c27ad99d?d=identicon&s=25 Nic Werner (Guest)
on 2006-01-17 03:25
(Received via mailing list)
Thanks, that fixed part of the problem - I can use image_tag, but not
the url_for_file_column version:

<%= image_tag(@person['image']) %> *** WORKS ***
<%= image_tag url_for_file_column('person', 'image') %> *** SAME PROBLEM
***

I guess I'll just use the original image_tag, thanks!

- Nic.

On 1/16/06, Kyle Maxwell <kyle@kylemaxwell.com> wrote:
> >         file_column      :image_url
> > There shouldn't be two '/dhcp/public' there.
> and possibly either reserves it, or attaches magic functionality.
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>


--
- Nic
B0e227ae419295321ca2aff4c27ad99d?d=identicon&s=25 Nic Werner (Guest)
on 2006-01-17 03:31
(Received via mailing list)
Actually, that doesn't work, because image_tag just looked in /images,
where I happened to have the same jpg.

I need to use image_tag url_for_file_column to point to the dynamic
directory, but it repeats the /dhcp/public twice:

<img alt="Werner"
src="/dhcp/public/dhcp/public/person/image/1/werner.jpg" />

Anybody have any thoughts?

On 1/16/06, Nic Werner <nicwerner@gmail.com> wrote:
> On 1/16/06, Kyle Maxwell <kyle@kylemaxwell.com> wrote:
> > >         file_column      :image_url
> > > There shouldn't be two '/dhcp/public' there.
> > and possibly either reserves it, or attaches magic functionality.
> > Rails mailing list
> > Rails@lists.rubyonrails.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails
> >
> >
> >
>
>
> --
> - Nic
>


--
- Nic
B8ed55487e4f2f0feaeb68957dc07b21?d=identicon&s=25 Sebastian Kanthak (Guest)
on 2006-01-18 10:41
(Received via mailing list)
Hey Nic,

On 1/17/06, Nic Werner <nicwerner@gmail.com> wrote:
>
> <%= image_tag url_for_file_column('person', 'image_url') %>
>
> HTML generated is this:
>
> <img alt="Male_face"
> src="/dhcp/public/dhcp/public/person/image_url/3/male_face.jpg" />
>
> There shouldn't be two '/dhcp/public' there.

Is your rails app deployed at a sub-path (e.g., not directly at
top-level)? file_column has some issues here, that I'm currently
working on (Ara did some debugging, I just have to catch up).

Sebastian
B0e227ae419295321ca2aff4c27ad99d?d=identicon&s=25 Nic Werner (Guest)
on 2006-01-18 19:00
(Received via mailing list)
Hey Sebastian,

 It is displayed at sub-path, meaning I have WebRoot as the top level
for Apache, and then the app 'dhcp' is off of that, making it:

 /dhcp/public/person/image/1/male_face.jpg

Is that what you're referring to?

Thanks for the response, this has been holding me back. I'll try
pointing Apache at the app and see if that makes a difference

- Nic.

On 1/18/06, Sebastian Kanthak <skanthak@gmail.com> wrote:
> >         file_column      :image_url
> > There shouldn't be two '/dhcp/public' there.
>
--
- Nic
This topic is locked and can not be replied to.