hii <%if File::exists?("../data/aritcal/#{@content.id}")%> <div id="image_holder" class ="span-10 "> <%= image_tag "../data/artical/#{@content.id}" %> </div> <%end%> my this file exists not working please help. thanks rahul -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
maybe this is due to your relative path. are you sure the file is where you think it is? are you sure the current working directory is what you think it is? try File::exists?("#{RAILS_ROOT}/path/to/my/file") another thing: since you obviously left out some code and replaced it with "..." we can''t be sure your code is correct. are you? On 5 Mai, 08:23, Rahul Mehta <rahul23134...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> hii > > <%if File::exists?("../data/aritcal...@content.id}")%> > > <div id="image_holder" class ="span-10 "> > <%= image_tag "../data/artical...-SxirU7qN7fi8rHFcjEY/OA@public.gmane.org}" %> > </div> > <%end%> > > my this file exists not working > > please help. > > thanks > > rahul > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
m sure of the path dear .. On Wed, May 5, 2010 at 1:23 PM, MaD <mayer.dominik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> maybe this is due to your relative path. are you sure the file is > where you think it is? are you sure the current working directory is > what you think it is? > try File::exists?("#{RAILS_ROOT}/path/to/my/file") > > another thing: since you obviously left out some code and replaced it > with "..." we can''t be sure your code is correct. are you? > > > On 5 Mai, 08:23, Rahul Mehta <rahul23134...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > hii > > > > <%if File::exists?("../data/aritcal...-SxirU7qN7fi8rHFcjEY/OA@public.gmane.org}")%> > > > > <div id="image_holder" class ="span-10 "> > > <%= image_tag "../data/ > artical...-SxirU7qN7fi8rHFcjEY/OA@public.gmane.org}" %> > > </div> > > <%end%> > > > > my this file exists not working > > > > please help. > > > > thanks > > > > rahul > > > > -- > > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > > For more options, visit this group athttp:// > groups.google.com/group/rubyonrails-talk?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On May 5, 8:53 am, MaD <mayer.domi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> maybe this is due to your relative path. are you sure the file is > where you think it is? are you sure the current working directory is > what you think it is? > try File::exists?("#{RAILS_ROOT}/path/to/my/file") >On top of that, if the current working directory is the root of the app (which is usually is) then with a normal setup a browser won''t be able to access that file, since its not in public. If that''s not the case then you''re going to have to explain in what way things don''t work. Does it work if you try from a console? is @content what you think it is? Fred> another thing: since you obviously left out some code and replaced it > with "..." we can''t be sure your code is correct. are you? > > On 5 Mai, 08:23, Rahul Mehta <rahul23134...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > hii > > > <%if File::exists?("../data/aritcal...@content.id}")%> > > > <div id="image_holder" class ="span-10 "> > > <%= image_tag "../data/artical...-SxirU7qN7fi8rHFcjEY/OA@public.gmane.org}" %> > > </div> > > <%end%> > > > my this file exists not working > > > please help. > > > thanks > > > rahul > > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 5 May 2010 07:23, Rahul Mehta <rahul23134654-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <%if File::exists?("../data/aritcal/#{@content.id}")%> > > <%= image_tag "../data/artical/#{@content.id}" %>The typos probably won''t help - you spell the directory "aritcal" in the check, and "artical" in the image tag. The method I''ve seen for checking files is "File.exists?..." not "File::exists?" (not sure if your way would work anyway) And as others have said, even if the file does exist, the image tag won''t see it because it''s not in the public path. But let''s come back to the problem you''re trying to solve: how are you attaching files to your content object? Maybe using a plugin like paperclip would save you a lot of the hassle. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 5 May 2010 10:07, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The method I''ve seen for checking files is "File.exists?..." not > "File::exists?" (not sure if your way would work anyway)In fact, "File.exist?" (without the ''s'') is preferred according to the API. http://ruby-doc.org/core/classes/File.html#M002556 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I experienced the same problems in a Ruby and Rails project. But when I used File.exist? instead of File.exists? it did work properly. Seems there is a problem with that or it works different. Cheers, Chris -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.