Skip to content

Commit

Permalink
Merge branch 'hotfix/0.4.1_fix'
Browse files Browse the repository at this point in the history
* hotfix/0.4.1_fix:
  bad fix bug
  • Loading branch information
kalashnikovisme committed Aug 27, 2015
2 parents eb4f2ec + aee313b commit a3ad00e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/forms/application_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ def find_with_model_by *args
end

def new_with_model *args
obj = obj_class.new(*args)
self.new obj
obj = obj_class.new *args
active_form = self.new obj
#active_form.forms.each { |collection| collection.each { |f| f.delete } }
active_form
end

def obj_class
Expand Down
3 changes: 1 addition & 2 deletions app/forms/member_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ class MemberForm < ApplicationForm
attributes :state_event, :parent_id, :school

association :positions do
attributes :title, :begin_date, :member_id, :state, required: true
attributes :end_date, :for_now
attributes :title, :begin_date, :member_id, :state, :end_date, :for_now
end
end
9 changes: 9 additions & 0 deletions app/models/member.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,13 @@ def has_auth_provider?(provider)

#FIXME tags association
include Concerns::TagsHelper

#FIXME try fix active form
after_save :remove_empty_positions

private

def remove_empty_positions
registrations.where(user_id: nil).map &:destroy
end
end

0 comments on commit a3ad00e

Please sign in to comment.