This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// empty fields will break you application | |
conversation = current_user.send_message(recipients, body, subject).conversation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@conversation_transient_model = ConversationTransientModel.new(conversation_params) | |
if @conversation_transient_model.valid? | |
recipients = User.where(id: @conversation_transient_model.recipients) | |
conversation = current_user.send_message(recipients, @conversation_transient_model.body, @conversation_transient_model.subject).conversation | |
flash[:notice] = "Your message was successfully sent!" | |
redirect_to conversation_path(conversation) | |
else | |
flash[:error] = "Errors found!" | |
render action: 'new' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConversationTransientModel | |
include ActiveModel::Validations | |
include ActiveModel::Validations::Callbacks | |
include ActiveModel::Conversion | |
extend ActiveModel::Naming | |
attr_accessor :recipients, :subject, :body | |
before_validation :clear_empty_recipients | |
validates :recipients, presence: true | |
validates :subject, presence: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mailboxer::Receipt.class_eval do | |
has_secure_token | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mailboxer.setup do |config| | |
... | |
config.notification_mailer = NotificationMailer | |
config.message_mailer = MessageMailer | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NotificationMailer < Mailboxer::NotificationMailer | |
def mail(headers = {}, &block) | |
headers[:template_path] = 'mailboxer/message_mailer' | |
receipts = @message.receipts.select { |receipt| receipt.receiver == @receiver && receipt.mailbox_type == 'inbox' } | |
raise "Unexpected number of receipts (= #{receipts.count}) for receiver #{@receiver.email}" if receipts.count != 1 | |
receipt = receipts.first | |
headers[:from] = Mailboxer.default_from.sub '@', "-#{receipt.token}@" | |
super(headers, &block) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir <Anwendungsverzeichnis> | |
cd <Anwendungsverzeichnis> | |
composer create-project kenjis/codeigniter-composer-installer . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
DocumentRoot /Users/bjoerne/Source/codeigniter-routing/public | |
ServerName codeigniter-routing.bjoerne.local | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Directory "/Users/bjoerne/Source/codeigniter-routing"> | |
Options FollowSymLinks Multiviews Indexes | |
MultiviewsMatch Any | |
AllowOverride All | |
Require all granted | |
</Directory> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function index() | |
{ | |
} | |
public function show($id) | |
{ | |
} | |
public function new_item() | |
{ |
OlderNewer