diff --git a/app/models/page.rb b/app/models/page.rb index b9050770..2c141841 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -15,10 +15,10 @@ 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 -end \ No newline at end of file +end diff --git a/app/views/admin/homes/_form.html.erb b/app/views/admin/homes/_form.html.erb index 6ab0e382..aa0395c6 100644 --- a/app/views/admin/homes/_form.html.erb +++ b/app/views/admin/homes/_form.html.erb @@ -15,8 +15,8 @@ <% end %>
-<%= 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] } %>
diff --git a/app/views/admin/pages/_form.html.erb b/app/views/admin/pages/_form.html.erb index 05503a73..a84b872a 100644 --- a/app/views/admin/pages/_form.html.erb +++ b/app/views/admin/pages/_form.html.erb @@ -19,8 +19,8 @@ <% end %>
-<%= 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] } %>