Sha256: b08b8e50508e173b5d95c01d62317b7271428670f6ecb79537cb96963ad0d365
Contents?: true
Size: 764 Bytes
Versions: 2
Compression:
Stored size: 764 Bytes
Contents
class ActivitiesController < AuthorizedController belongs_to :project, :optional => true belongs_to :person, :optional => true has_scope :by_date has_scope :by_period, :using => [:from, :to] has_scope :by_project_id def new # Allow callers specifying defaults if params[:activity] @activity = Activity.new(params[:activity]) else @activity = Activity.new(:date => Date.today) end # Educated guessing of person @activity.person ||= current_user.person if current_user # Educated guessing of project @activity.project_id ||= params[:project_id] if params[:project_id] @activity.project_id ||= @activity.person.latest_project.id new! end def create create! { @activity.project } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bookyt_projects-0.21.0 | app/controllers/activities_controller.rb |
bookyt_projects-0.20.0 | app/controllers/activities_controller.rb |