Sha256: e58e0142225c5a5178968c518b79101f5514cdf1fadf61fca796640ed78f3250

Contents?: true

Size: 859 Bytes

Versions: 7

Compression:

Stored size: 859 Bytes

Contents

module Imagine
  class AlbumsController < ::ApplicationController
    def index
    end

    def show
      load_album
      return render_show_view
    end

    def new
      load_new_album
    end

    def create
      load_new_album
      if ::Imagine::Warehouses::Album.save(@album)
        redirect_to @album, :notice => "Album has been created!"
      else
        flash.now[:error] = "There was a problem creating the album."
        render :action => 'new'
      end
    end

    protected
    def load_new_album
      @album = ::Imagine::Warehouses::Album.new(params[:album])
    end

    def load_album
      @album = ::Imagine::Warehouses::Album.find(params[:id])
    end

    def render_show_view
      if params[:plugin]
        render :action => "/#{params[:plugin]}/show"
      else
        render :action => 'show'
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
imagine-0.2.0 app/controllers/imagine/albums_controller.rb
imagine-0.1.7 app/controllers/imagine/albums_controller.rb
imagine-0.1.6 app/controllers/imagine/albums_controller.rb
imagine-0.1.5 app/controllers/imagine/albums_controller.rb
imagine-0.1.4 app/controllers/imagine/albums_controller.rb
imagine-0.1.3 app/controllers/imagine/albums_controller.rb
imagine-0.1.2 app/controllers/imagine/albums_controller.rb