Class: BatchActivitiesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- BatchActivitiesController
- Defined in:
- app/controllers/batch_activities_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/controllers/batch_activities_controller.rb', line 14 def create date = Date.parse(params[:batch_activities][:date]) @activites = params[:activities].collect{|activity_params| Activity.create(activity_params.merge(:date => date)) } redirect_to activities_path(:by_date => date.to_s(:db)) end |
#new ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'app/controllers/batch_activities_controller.rb', line 2 def new # Allow callers specifying defaults @date = params[:date] || Date.today # TODO: only employees currently working for tenant people = current_tenant.company.employees @activities = people.map{|person| person.activities.build(:project => person.latest_project) } end |