Sha256: 166060af4dc71c552ebeac7ab172dee1c982bd575c5da9c7f167a4df85695812

Contents?: true

Size: 1.07 KB

Versions: 22

Compression:

Stored size: 1.07 KB

Contents

class ArticlesController < ApplicationController
  expose(:articles) { Article.all }
  expose(:article)
  
  def index
  end

  def admin
    user = User.create! :name => 'stanislaw', :role => 'user', :email => 'stanislaw@mail.ru'
    admin_user = User.create! :name => 'administrator', :role => 'admin', :email => 'admin@mail.ru'

    # Note: this is recommended approach
    # admin_user.masquerade_as user

    # Note: this requires gem 'friendly-id' or similar!
    admin_user.masquerade_as 'stanislaw'
    session[:current_admin] = admin_user
  end

  def guest
  end

  def admin_account
  end

  def show
  end

  def new
  end

  def create
    if article.save
      redirect_to article, :notice => "Successfully created article."
    else
      render :new
    end
  end

  def edit
  end
  
  def update
    if article.update_attributes(params[:article])
      redirect_to article, :notice => "Successfully updated article."
    else
      render :edit
    end
  end
  
  def destroy
    article.destroy
    redirect_to articles_url, :notice => "Successfully destroyed article."
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
cantango-0.9.4.7 spec/dummy/app/controllers/articles_controller.rb
cantango-0.9.4.6 spec/dummy/app/controllers/articles_controller.rb
cantango-0.9.4.5 spec/dummy/app/controllers/articles_controller.rb
cantango-0.9.4.3 spec/dummy/app/controllers/articles_controller.rb
cantango-0.9.4.2 spec/dummy/app/controllers/articles_controller.rb
cantango-0.9.4.1 spec/dummy/app/controllers/articles_controller.rb
cantango-0.9.4 spec/dummy/app/controllers/articles_controller.rb
cantango-0.9.3.2 spec/dummy/app/controllers/articles_controller.rb
cantango-0.8.9.5 spec/dummy/app/controllers/articles_controller.rb
cantango-0.8.9.4 spec/dummy/app/controllers/articles_controller.rb
cantango-0.8.9.3 spec/dummy/app/controllers/articles_controller.rb
cantango-0.8.9.2 spec/dummy/app/controllers/articles_controller.rb
cantango-0.8.9.1 spec/dummy/app/controllers/articles_controller.rb
cantango-0.8.9 spec/dummy/app/controllers/articles_controller.rb
cantango-0.8.8.1 spec/dummy/app/controllers/articles_controller.rb
cantango-0.8.8 spec/dummy/app/controllers/articles_controller.rb
cantango-0.8.7 spec/dummy/app/controllers/articles_controller.rb
cantango-0.8.6.2 spec/dummy/app/controllers/articles_controller.rb
cantango-0.8.6.1 spec/dummy/app/controllers/articles_controller.rb
cantango-0.8.6 spec/dummy/app/controllers/articles_controller.rb