diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/groups_controller.rb | 2 | ||||
-rw-r--r-- | app/models/group.rb | 3 | ||||
-rw-r--r-- | app/views/groups/_form_core.html.haml | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 74ad7c8..d48707c 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -11,7 +11,7 @@ class GroupsController < ApplicationController end def new - @group = Group.new + @group.active = true; end def create diff --git a/app/models/group.rb b/app/models/group.rb index e0cfaab..c459530 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -5,6 +5,9 @@ class Group < ActiveRecord::Base has_many :group_permissions, :dependent => :destroy has_many :permittances, :foreign_key => :target_group_id, :class_name => "GroupPermission", :dependent => :destroy + validates :name, + :presence => true + def to_s self.name end diff --git a/app/views/groups/_form_core.html.haml b/app/views/groups/_form_core.html.haml index 1f9a39f..02f296b 100644 --- a/app/views/groups/_form_core.html.haml +++ b/app/views/groups/_form_core.html.haml @@ -1,4 +1,4 @@ .inputs = f.input :name, :label => t('groups.form.name.label'), :hint => conditional_hint('groups.form.name.hint') - = f.input :active, :label => t('groups.form.active.label'), :hint => conditional_hint('groups.form.active.hint') = f.input :comment, :label => t('groups.form.comment.label'), :hint => conditional_hint('groups.form.comment.hint') + = f.input :active, :label => t('groups.form.active.label'), :hint => conditional_hint('groups.form.active.hint') |