Sha256: 5c10109e8d2dc5108d22607123942551ca578a1fe453e68b344808ff52c1d732
Contents?: true
Size: 604 Bytes
Versions: 5
Compression:
Stored size: 604 Bytes
Contents
class ActivitiesController < AuthorizedController belongs_to :project, :optional => true def new # Allow callers specifying defaults if params[:activity] @activity = Activity.new(params[:activity]) else @activity = Activity.new(:when => Date.today) end # Nested resources support @activity.project_id ||= params[:project_id] if params[:project_id] # Educated guessing of defaults @activity.person = current_user.person if current_user new! end def create create! { @activity.project } end def index redirect_to :projects end end
Version data entries
5 entries across 5 versions & 1 rubygems