Sha256: 6e63263a6c9edc55ba18bc8ea65ac1d49f9f553d6ae0078b9a80c7d091ce9c00
Contents?: true
Size: 1.57 KB
Versions: 2
Compression:
Stored size: 1.57 KB
Contents
module Georgia class MessagesController < ApplicationController load_and_authorize_resource class: Georgia::Message before_filter :prepare_search, only: [:search, :show, :spam, :ham] def index redirect_to action: :search end def search end # Destroy multiple assets def destroy ids = params[:id].split(',') if @messages = Message.destroy(ids) render layout: false else head :internal_server_error end end def destroy_all_spam if Message.spam.destroy_all redirect_to :back, notice: 'All spam messages have been successfully deleted.' else redirect_to :back, alert: 'Oups. Something went wrong.' end end def show @message = Message.find(params[:id]).decorate end def spam @message = Message.find(params[:id]) if @message.spam! @message.update_attribute(:spam, true) redirect_to :back, notice: 'Message successfully marked as spam.' else redirect_to :back, alert: 'Oups. Something went wrong.' end end def ham @message = Message.find(params[:id]) if @message.ham! == false @message.update_attribute(:spam, false) redirect_to :back, notice: 'Message successfully marked as ham.' else redirect_to :back, alert: 'Oups. Something went wrong.' end end private def prepare_search @results = Georgia::Indexer.adapter.search(Georgia::Message, params) @messages = Georgia::MessageDecorator.decorate_collection(@results) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
georgia-0.7.3 | app/controllers/georgia/messages_controller.rb |
georgia-0.7.2 | app/controllers/georgia/messages_controller.rb |