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
# lib/backup.rake | |
task :backup => [:environment] do | |
# делаем полный дамп базы и ассетов | |
ENV['TAG'] = 'backup' | |
Rake::Task['dump'].invoke | |
# храним 30 последних таких дампов | |
ENV['TAG'] = 'backup' | |
ENV['LEAVE'] = '30' |
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
# создаём дамп, содержащий только таблицу my_people_texts | |
# | |
$ rake dump TABLES='my_people_texts' ASSETS='' | |
Tables: 100.0% | |
20140918080518.tgz | |
# заливаем дамп на сервер | |
# | |
$ cap dump:upload LIKE='20140918080518' | |
... |
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
<% # app/views/shared/_flashes.html.erb %> | |
<% flash.each do |key, message| %> | |
<p class="<%= key %>"><%= message %></p> | |
<% 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
# app/controllers/flash_now_example_controller.rb | |
class FlashNowExampleController < ActionController::Base | |
def test | |
flash.now.notice = 'На свете счастья нет, но есть покой и воля' | |
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
# app/controllers/flash_example_controller.rb | |
class FlashExampleController < ActionController::Base | |
add_flash_types :error | |
def test | |
redirect_to admin_auth_login_path, :error => 'Вы должны выполнить вход' | |
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
class UsersController < ApplicationController | |
def create | |
redirect_to root_path, :notice => 'Что тревожишь ты меня?' | |
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
# app/controllers/example_controller.rb | |
class ExampleController < ActionController::Base | |
def index | |
flash.notice = 'Мне не спится, нет огня;' | |
flash[:alert] = 'Всюду мрак и сон докучный.' | |
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
# app/models/user.rb | |
class User < ActiveRecord::Base | |
include Allowed::UserRules | |
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
# app/controllers/web/admin/application_controller.rb | |
class Web::ApplicationController < Web::ApplicationController | |
include Concerns::Auth | |
rescue_from AccessDenied, :with => :access_denied_handler | |
private | |
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
# app/controllers/web/application_controller.rb | |
class Web::ApplicationController < ApplicationController | |
include Concerns::Auth | |
rescue_from AccessDenied, :with => :access_denied_handler | |
private | |