On 7/21/05, Paul <paul.marsh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I am working on my configuration generator since I haven''t touched
it
> since 0.11. Seems that in one of the models where I save to a file
> using File.open() I have the following
>
> File.open("#{RAILS_ROOT}config/#{self.name.downcase.gsub(/\s+/,
> ''_'')}_settings.yaml", "w")
>
> An exception is thrown because it resolves that to just config/
> instead of the full path.
>
> If I replace #{RAILS_ROOT} with a hard path then it works fine.
>
> Just curious why RAILS_ROOT doesn''t seem to work in the model
files.
try this:
File.open("#{RAILS_ROOT}/config/#{self.name.downcase.gsub(/\s+/,
''_'')}_settings.yaml", "w")
(notice the / after #{RAILS_ROOT})
--
rick
http://techno-weenie.net