Sha256: 9d0632a8731d56fe2edb9ab8babcf7d4391869310719a3c738f65da7b7a5e073
Contents?: true
Size: 1.04 KB
Versions: 7
Compression:
Stored size: 1.04 KB
Contents
class SelectionsController < ApplicationController before_filter :parent_finder def index if @parent @selections = @parent.children else @selections = Selection.roots end end def new @selection = @parent.children.new end def edit @selection = @parent.children.find(params[:id]) end def create @selection = @parent.children.new(params[:selection]) if @selection.save redirect_to selection_selections_path(@parent), notice: 'Selection was successfully created.' else render action: 'new' end end def update @selection = Selection.find(params[:id]) if @selection.update_attributes(params[:selection]) redirect_to selection_selections_path(@parent), notice: 'Selection was successfully updated.' else render action: 'edit' end end def destroy @selection = Selection.find(params[:id]) @selection.destroy redirect_to selections_url end private def parent_finder @parent = Selection.find_by_id(params[:selection_id]) end end
Version data entries
7 entries across 7 versions & 1 rubygems