Don’t simply test for the presence of the magic Paperclip attribute, it will return a paperclip Attachment object and thus always be true:
- if user.photo.present? # always true
= image_tag(user.photo.url)
class Avatar < ActiveRecord::Base | |
attr_accessor :content_type, :original_filename, :image_data | |
before_save :decode_base64_image | |
has_attached_file :image, | |
PAPERCLIP_CONFIG.merge( | |
:styles => { | |
:thumb => '32x32#', | |
:medium => '64x64#', |
# Русский перевод для https://github.com/plataformatec/devise/tree/v3.5.6 | |
# Другие переводы на http://github.com/plataformatec/devise/wiki/I18n | |
ru: | |
devise: | |
confirmations: | |
confirmed: "Ваша учётная запись успешно подтверждена." | |
send_instructions: "В течение нескольких минут вы получите письмо с инструкциями по подтверждению вашей учётной записи." | |
send_paranoid_instructions: "Если ваш адрес email есть в нашей базе данных, то в течение нескольких минут вы получите письмо с инструкциями по подтверждению вашей учётной записи." | |
failure: |
You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.
# 02.03.2016 Перевод gem rails_admin ~> 0.8 | |
# Не забудьте добавить переводы названия модели (в т.ч. мн. ч.) и - опционально - атрибутов. | |
# Некоторые переводы, где нужны склонения, видоизменены, тем не менее, имхо, | |
# это не повлияло на удобство интерфейса | |
ru: | |
admin: | |
js: | |
true: 'True' | |
false: 'False' |
# По умолчанию запускаем только необходимых для тестов наблюдателей, | |
# то есть всех, кроме server. | |
# Для запуска всех: bundle exec guard -g default | |
scope groups: ['specs'] | |
group 'specs' do | |
# запускаем тесты и использованием Spring | |
guard :rspec, cmd: "bundle exec spring rspec" do | |
require "guard/rspec/dsl" | |
dsl = Guard::RSpec::Dsl.new(self) |
### Nginx ### | |
check process nginx with pidfile /opt/nginx/logs/nginx.pid | |
start program = "/etc/init.d/nginx start" | |
stop program = "/etc/init.d/nginx stop" | |
if cpu > 60% for 2 cycles then alert | |
if cpu > 80% for 5 cycles then restart | |
if memory usage > 80% for 5 cycles then restart | |
if failed host 127.0.0.1 port 80 protocol http | |
then restart | |
if 3 restarts within 5 cycles then timeout |
# paths | |
app_path = "/home/deployer/qna" | |
working_directory "#{app_path}/current" | |
pid "#{app_path}/current/tmp/pids/unicorn.pid" | |
# listen | |
listen "/tmp/unicorn.qna.sock", :backlog => 64 | |
# logging | |
stderr_path "log/unicorn.stderr.log" |
At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)
Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.
# in spec/support/omniauth_macros.rb | |
module OmniauthMacros | |
def mock_auth_hash | |
# The mock_auth configuration allows you to set per-provider (or default) | |
# authentication hashes to return during integration testing. | |
OmniAuth.config.mock_auth[:twitter] = { | |
'provider' => 'twitter', | |
'uid' => '123545', | |
'user_info' => { | |
'name' => 'mockuser', |