Sha256: c85cbcd567b9241d88ddfdf9ce701dbd12c5c3ff85dc01d6bef690523239c170

Contents?: true

Size: 675 Bytes

Versions: 6

Compression:

Stored size: 675 Bytes

Contents

class Public::PagesController < PublicController

  def create
    @current_page = Page.new params[:page]
    if @current_page.save
      flash[:notice] = "Page saved!"
      redirect_to :action => :index
    else
      flash[:error] = "There was a problem"
    end
  end
  
  def update
    if current_page.update_attributes(params[:page])
      flash[:notice] = "Page updated!"
      redirect_to :action => :index
    else
      flash[:error] = "There was a problem"
      render :action => :edit
    end

  end
  
  protected 
  
    helper_method :current_page
    
    def current_page
      @current_page ||= params[:id] ? Page.find(params[:id]) : Page.new
    end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ample_assets-0.0.7 test/dummy/app/controllers/public/pages_controller.rb
ample_assets-0.0.6 test/dummy/app/controllers/public/pages_controller.rb
ample_assets-0.0.4 test/dummy/app/controllers/public/pages_controller.rb
ample_assets-0.0.3 test/dummy/app/controllers/public/pages_controller.rb
ample_assets-0.0.2 test/dummy/app/controllers/public/pages_controller.rb
ample_assets-0.0.1 test/dummy/app/controllers/public/pages_controller.rb