Sha256: 16631f19132c5b7ed536be6324a461d9c1e73da5429653c0c5f338266bcc923b

Contents?: true

Size: 584 Bytes

Versions: 1

Compression:

Stored size: 584 Bytes

Contents

class ActivitiesController < AuthorizedController
  belongs_to :project

  def new
    # Allow callers specifying defaults
    @activity = Activity.new(params[:activity])

    # 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
    @activity = Activity.create(params[:activity])
    @project = @activity.project

    create! { project_path(@project) }
  end

  def index
    redirect_to :projects
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bookyt_projects-0.6.0 app/controllers/activities_controller.rb