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
# Класс создатель объектов Url и связанных сущностей. | |
class UrlCreator | |
attr_reader :uri, :domain, :url_path, :query_string, :url | |
# Инициирует модель Url на основе полного URL. | |
# | |
# @param [String] full_url какой-то URL (http://www.linux.org.ru/forum/talks/8623652) | |
# | |
def initialize(full_url) | |
@uri = URI.parse(full_url) |
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
# controller | |
class UsersController < ApplicationController | |
def send_recovery | |
user = User.find_by(email: params[:email].to_s.downcase) | |
if user.nil? | |
flash[:message] = t('email_not_found') | |
redirect_to recover_form_users_path | |
else | |
send_recovery_code user | |
redirect_to recover_users_path |