Replaced IndexController by Home- and FoodcoopController. Some reorganizing in groups/memberships-logic (moved memberships out of admin-namespace).

This commit is contained in:
Benjamin Meichsner 2009-01-15 12:14:01 +01:00
parent fadc951208
commit 6ce6c2c75a
70 changed files with 553 additions and 934 deletions

View file

@ -18,17 +18,14 @@ class Invite < ActiveRecord::Base
belongs_to :user
belongs_to :group
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :message => 'ist keine gültige Email-Adresse'
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
validates_presence_of :user
validates_presence_of :group
validates_presence_of :token
validates_presence_of :expires_at
attr_accessible :email, :user, :group
# messages
ERR_EMAIL_IN_USE = 'ist bereits in Verwendung'
protected
# Before validation, set token and expires_at.
@ -46,7 +43,9 @@ class Invite < ActiveRecord::Base
# Custom validation: check that email does not already belong to a registered user.
def validate_on_create
errors.add(:email, ERR_EMAIL_IN_USE) unless User.find_by_email(self.email).nil?
unless User.find_by_email(self.email).nil?
errors.add(:email, 'ist bereits in Verwendung. Person ist schon Mitglied der Foodcoop.')
end
end
end

View file

@ -1,5 +1,5 @@
# == Schema Information
# Schema version: 20090102171850
# Schema version: 20090114101610
#
# Table name: tasks
#
@ -8,7 +8,7 @@
# description :string(255)
# due_date :date
# done :boolean(1)
# group_id :integer(4)
# workgroup_id :integer(4)
# assigned :boolean(1)
# created_on :datetime not null
# updated_on :datetime not null
@ -18,7 +18,9 @@
class Task < ActiveRecord::Base
has_many :assignments, :dependent => :destroy
has_many :users, :through => :assignments
belongs_to :group
belongs_to :workgroup
named_scope :non_group, :conditions => { :workgroup_id => nil, :done => false }, :order => "due_date ASC"
# form will send user in string. responsibilities will added later
attr_protected :users