Module: HyperKittenMeow::Concerns::Controllers::Admin::PostsController
- Extended by:
- ActiveSupport::Concern
- Included in:
- Admin::PostsController
- Defined in:
- lib/hyper_kitten_meow/concerns/controllers/admin/posts_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/hyper_kitten_meow/concerns/controllers/admin/posts_controller.rb', line 17 def create @post = Post.new(post_params) find_users if @post.save flash[:success] = "Post successfully created." redirect_to admin_posts_path else render :new end end |
#edit ⇒ Object
29 30 31 32 33 |
# File 'lib/hyper_kitten_meow/concerns/controllers/admin/posts_controller.rb', line 29 def edit find_post find_users end |
#index ⇒ Object
7 8 9 |
# File 'lib/hyper_kitten_meow/concerns/controllers/admin/posts_controller.rb', line 7 def index @pagy, @posts = pagy(Post.sorted_by_published_date) end |
#new ⇒ Object
11 12 13 14 15 |
# File 'lib/hyper_kitten_meow/concerns/controllers/admin/posts_controller.rb', line 11 def new @post = Post.new find_users end |
#update ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/hyper_kitten_meow/concerns/controllers/admin/posts_controller.rb', line 35 def update find_post find_users if @post.update(post_params) flash[:success] = "Post was successfully updated." redirect_to admin_posts_path else render action: 'edit' end end |