Skip to content

Commit

Permalink
convert prohibited relative to absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
emiddleton committed Jul 31, 2009
1 parent 35995a5 commit c99a2d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/models/theme.rb
Expand Up @@ -10,11 +10,11 @@ def initialize(name, path)

def layout(action=:default)
if action.to_s == 'view_page'
if File.exists? "../../themes/#{name}/layouts/pages.html.erb"
return "../../themes/#{name}/layouts/pages.html.erb"
if File.exists? "#{RAILS_ROOT}/themes/#{name}/layouts/pages.html.erb"
return "#{RAILS_ROOT}/themes/#{name}/layouts/pages.html.erb"
end
end
"../../themes/#{name}/layouts/default.html.erb"
"#{RAILS_ROOT}/themes/#{name}/layouts/default.html.erb"
end

def description
Expand Down
4 changes: 2 additions & 2 deletions spec/models/theme_spec.rb
Expand Up @@ -5,8 +5,8 @@
@theme = Theme.new("test", "test")
end

it 'layout path should be "../../themes/test/layouts/default.html.erb"' do
@theme.layout('index').should == "../../themes/test/layouts/default.html.erb"
it 'layout path should be "#{RAILS_ROOT}/themes/test/layouts/default.html.erb"' do
@theme.layout('index').should == "#{RAILS_ROOT}/themes/test/layouts/default.html.erb"
end
end

Expand Down

0 comments on commit c99a2d8

Please sign in to comment.