Skip to content

Commit

Permalink
Use Page.root i.o. Page.find_by_path '/' and use page.path i.o. page.url
Browse files Browse the repository at this point in the history
  • Loading branch information
jomz committed Jun 14, 2012
1 parent 457892a commit 2dbe5ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/models/sheet.rb
Expand Up @@ -10,15 +10,15 @@ def self.included(base)
class_inheritable_accessor :sheet_root

def self.root
Page.find_by_path('/').children.first(:conditions => {:class_name => self.to_s})
Page.root.children.first(:conditions => {:class_name => self.to_s})
rescue NoMethodError => e
e.extend Sheet::InvalidHomePage
raise e
end

def self.create_root
s = self.new_with_defaults
s.parent_id = Page.find_by_slug('/').id
s.parent_id = Page.root.id
s.created_by_id = ''
s.slug = self.name == 'StylesheetPage' ? 'css' : 'js'
s.save
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/styles/edit.html.haml
Expand Up @@ -3,7 +3,7 @@
%p.title
= label :sheet_page, :slug, t('slug')
= f.text_field :slug, :class => 'textbox', :maxlength => 255, :id => "sheet_page_slug"
%span.hint= %{Path: #{@root.url}<span id="this_slug">#{model.slug}</span>}
%span.hint= %{Path: #{@root.path}<span id="this_slug">#{model.slug}</span>}
- f.fields_for :parts do |p|
%p.content
= p.label :content, t('content')
Expand Down

0 comments on commit 2dbe5ec

Please sign in to comment.