Class: Wafflemix::PostsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Wafflemix::PostsController
- Defined in:
- app/controllers/wafflemix/posts_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#index ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/wafflemix/posts_controller.rb', line 7 def index @posts = Post.published @tags = Post.tag_counts_on(:tags) respond_to do |format| format.html format.json { render json: @posts } end end |
#mercury_update ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/controllers/wafflemix/posts_controller.rb', line 27 def mercury_update post = Post.find(params[:id]) post.title = params[:content][:post_title][:value] post.body = params[:content][:post_body][:value] post.excerpt = params[:content][:post_excerpt][:value] post.save! render text: "" end |
#show ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/wafflemix/posts_controller.rb', line 17 def show @post = Post.find(params[:id]) @tags = Post.tag_counts_on(:tags) respond_to do |format| format.html format.json { render json: @post } end end |
#tagged ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/wafflemix/posts_controller.rb', line 36 def tagged @posts = Post.published.tagged_with(params[:id]) @tags = @posts.tag_counts_on(:tags) respond_to do |format| format.html format.json { render json: @posts } end end |