base layout on id instead of name

This commit is contained in:
chris 2011-03-01 15:58:42 +08:00 committed by ihower
parent 6e100d3499
commit fc98757772
3 changed files with 7 additions and 7 deletions

View File

@ -15,8 +15,8 @@ class Page < Item
def setup_default_value
super
if self.layout_name
self.layout_id = Layout.first(:conditions => {:name => self.layout_name} ).id
if self.layout_id
self.layout_name = Layout.find(layout_id).name
end
end

View File

@ -15,8 +15,8 @@
<% end %>
<p>
<%= f.label :layout_name, t('admin.layout_name') %>
<%= f.select :layout_name, Layout.all.map{ |l| [l.description, l.name] } %>
<%= f.label :layout_id, t('admin.layout_name') %>
<%= f.select :layout_id, Layout.all.map{ |l| [l.description, l.id] } %>
</p>
<p>

View File

@ -19,8 +19,8 @@
<% end %>
<p>
<%= f.label :layout_name, t('admin.layout_name') %>
<%= f.select :layout_name, Layout.all.map{ |l| [l.description, l.name] } %>
<%= f.label :layout_id, t('admin.layout_name') %>
<%= f.select :layout_id, Layout.all.map{ |l| [l.description, l.id] } %>
</p>
<p>