Class: Admin::ArticlesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::ArticlesController
- Defined in:
- app/controllers/cornerstone/admin/articles_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /cornerstone/admin/articles/.
-
#destroy ⇒ Object
DELETE /cornerstone/admin/articles/:id.
-
#edit ⇒ Object
GET /cornerstone/admin/articles/:id/edit.
- #index ⇒ Object
-
#new ⇒ Object
GET /cornerstone/admin/articles/new.
- #show ⇒ Object
-
#update ⇒ Object
PUT /cornerstone/admin/articles/:id.
Instance Method Details
#create ⇒ Object
POST /cornerstone/admin/articles/
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/cornerstone/admin/articles_controller.rb', line 24 def create @article = Article.new(params[:article]) if @article.save flash[:notice] = 'Article was successfully created.' else @categories = Category.articles end respond_with(:admin, @article) end |
#destroy ⇒ Object
DELETE /cornerstone/admin/articles/:id
53 54 55 56 57 |
# File 'app/controllers/cornerstone/admin/articles_controller.rb', line 53 def destroy @article = Article.find(params[:id]) flash[:notice] = 'Article was successfully destroyed.' if @article.destroy respond_with(:admin, @article, :location => admin_articles_path) end |
#edit ⇒ Object
GET /cornerstone/admin/articles/:id/edit
35 36 37 38 39 |
# File 'app/controllers/cornerstone/admin/articles_controller.rb', line 35 def edit @article = Article.find(params[:id]) @categories = Category.articles respond_with(:admin, @article) end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/cornerstone/admin/articles_controller.rb', line 6 def index @articles = Article.all respond_with(:admin, @articles) end |
#new ⇒ Object
GET /cornerstone/admin/articles/new
17 18 19 20 21 |
# File 'app/controllers/cornerstone/admin/articles_controller.rb', line 17 def new @article = Article.new @categories = Category.articles respond_with(:admin, @articles) end |
#show ⇒ Object
11 12 13 14 |
# File 'app/controllers/cornerstone/admin/articles_controller.rb', line 11 def show @article = Article.find(params[:id]) respond_with(:admin, @article) end |
#update ⇒ Object
PUT /cornerstone/admin/articles/:id
42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/cornerstone/admin/articles_controller.rb', line 42 def update @article = Article.find(params[:id]) if @article.update_attributes(params[:article]) flash[:notice] = 'Article was successfully updated.' else @categories = Category.articles end respond_with(:admin, @article) end |