hancock_cms 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/.rspec +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +113 -0
  9. data/Rakefile +1 -0
  10. data/app/assets/images/devices/login-bg.jpg +0 -0
  11. data/app/assets/images/rails-admin/hancock_logo.svg +5 -0
  12. data/app/assets/javascripts/hancock/app/back_to_top.coffee +24 -0
  13. data/app/assets/javascripts/hancock/cms.coffee +11 -0
  14. data/app/assets/javascripts/hancock/cms/flash.coffee +3 -0
  15. data/app/assets/javascripts/hancock/cms/init.coffee +1 -0
  16. data/app/assets/javascripts/hancock/cms/map.coffee +22 -0
  17. data/app/assets/javascripts/hancock/rails_admin/cms.ui.coffee +43 -0
  18. data/app/assets/javascripts/hancock/rails_admin/custom/ui.coffee +0 -0
  19. data/app/assets/javascripts/head.load.js +707 -0
  20. data/app/assets/javascripts/jquery.placeholder.js +157 -0
  21. data/app/assets/javascripts/rails_admin/custom/ui.coffee +2 -0
  22. data/app/assets/stylesheets/hancock/cms.sass +9 -0
  23. data/app/assets/stylesheets/hancock/cms/devise.sass +157 -0
  24. data/app/assets/stylesheets/hancock/cms/flash.sass +69 -0
  25. data/app/assets/stylesheets/hancock/cms/mixins.sass +98 -0
  26. data/app/assets/stylesheets/hancock/cms/normalize.scss +407 -0
  27. data/app/assets/stylesheets/hancock/cms/powered.sass +18 -0
  28. data/app/assets/stylesheets/hancock/rails_admin/cms.theming.sass +703 -0
  29. data/app/assets/stylesheets/hancock/rails_admin/custom/theming.sass +1 -0
  30. data/app/assets/stylesheets/hancock/toplink/toplink.sass +24 -0
  31. data/app/assets/stylesheets/rails_admin/custom/theming.sass +4 -0
  32. data/app/controllers/concerns/hancock/current_user.rb +12 -0
  33. data/app/controllers/concerns/hancock/decorators/home.rb +12 -0
  34. data/app/controllers/concerns/hancock/decorators/registrations.rb +5 -0
  35. data/app/controllers/concerns/hancock/decorators/sessions.rb +5 -0
  36. data/app/controllers/concerns/hancock/errors.rb +94 -0
  37. data/app/controllers/concerns/hancock/fancybox.rb +14 -0
  38. data/app/controllers/concerns/hancock/no_cache.rb +12 -0
  39. data/app/controllers/hancock/home_controller.rb +10 -0
  40. data/app/controllers/hancock/registrations_controller.rb +23 -0
  41. data/app/controllers/hancock/sessions_controller.rb +24 -0
  42. data/app/helpers/hancock/gzip_helper.rb +27 -0
  43. data/app/helpers/hancock/home_helper.rb +2 -0
  44. data/app/helpers/hancock/powered_helper.rb +42 -0
  45. data/app/models/concerns/hancock/boolean_field.rb +21 -0
  46. data/app/models/concerns/hancock/cacheable.rb +33 -0
  47. data/app/models/concerns/hancock/decorators/embedded_element.rb +28 -0
  48. data/app/models/concerns/hancock/enableable.rb +8 -0
  49. data/app/models/concerns/hancock/geocodeable.rb +4 -0
  50. data/app/models/concerns/hancock/hash_field.rb +113 -0
  51. data/app/models/concerns/hancock/html_field.rb +33 -0
  52. data/app/models/concerns/hancock/mappable.rb +91 -0
  53. data/app/models/concerns/hancock/model_localizeable.rb +33 -0
  54. data/app/models/concerns/hancock/rails_admin_patch.rb +86 -0
  55. data/app/models/concerns/hancock/sort_field.rb +20 -0
  56. data/app/models/concerns/hancock/sortable.rb +8 -0
  57. data/app/models/hancock/embedded_element.rb +17 -0
  58. data/app/views/blocks/_favicon.html.slim +60 -0
  59. data/app/views/blocks/_footer.html.slim +1 -0
  60. data/app/views/blocks/_header.html.slim +3 -0
  61. data/app/views/devise/passwords/edit.html.slim +29 -0
  62. data/app/views/devise/passwords/new.html.slim +19 -0
  63. data/app/views/devise/registrations/edit.html.slim +31 -0
  64. data/app/views/devise/registrations/new.html.slim +39 -0
  65. data/app/views/devise/sessions/new.html.slim +39 -0
  66. data/app/views/devise/shared/_links.html.slim +11 -0
  67. data/app/views/hancock/errors/_base.html.slim +3 -0
  68. data/app/views/hancock/errors/error_403.html.slim +1 -0
  69. data/app/views/hancock/errors/error_404.html.slim +1 -0
  70. data/app/views/hancock/errors/error_500.html.slim +1 -0
  71. data/app/views/hancock/home/index.html.slim +1 -0
  72. data/app/views/hancock/simple_captcha/_simple_captcha.html.slim +13 -0
  73. data/app/views/hancock/toplink/_toplink.html.slim +2 -0
  74. data/app/views/layouts/application.html.slim +35 -0
  75. data/app/views/layouts/hancock/devise/confirmations.html.slim +22 -0
  76. data/app/views/layouts/hancock/devise/passwords.html.slim +22 -0
  77. data/app/views/layouts/hancock/devise/registrations.html.slim +22 -0
  78. data/app/views/layouts/hancock/devise/sessions.html.slim +22 -0
  79. data/app/views/layouts/hancock/devise/unlocks.html.slim +22 -0
  80. data/app/views/layouts/rails_admin/_footer.html.slim +2 -0
  81. data/app/views/layouts/rails_admin/_footer_navigation.html.slim +20 -0
  82. data/app/views/layouts/rails_admin/_navigation.html.slim +73 -0
  83. data/app/views/layouts/rails_admin/_secondary_navigation.html.slim +32 -0
  84. data/app/views/layouts/rails_admin/application.html.haml +68 -0
  85. data/app/views/layouts/rails_admin/pjax.html.haml +17 -0
  86. data/app/views/rails_admin/main/_check_boxes.html.slim +27 -0
  87. data/app/views/rails_admin/main/_enum_check_boxes.html.slim +5 -0
  88. data/app/views/rails_admin/main/_enum_radio_buttons.html.slim +5 -0
  89. data/app/views/rails_admin/main/_form_hancock_multiselect.html.slim +48 -0
  90. data/app/views/rails_admin/main/_form_raw.html.slim +1 -0
  91. data/app/views/rails_admin/main/_hancock_hash.html.slim +9 -0
  92. data/app/views/rails_admin/main/_hancock_hash_ml.html.slim +10 -0
  93. data/app/views/rails_admin/main/_hancock_html.html.slim +16 -0
  94. data/app/views/rails_admin/main/_hancock_html_ml.html.slim +53 -0
  95. data/app/views/shared/_admin_link.html.slim +3 -0
  96. data/app/views/shared/_messages.html.slim +7 -0
  97. data/config/initializers/embedded_findable.rb +57 -0
  98. data/config/initializers/hancock_cms.rb +11 -0
  99. data/config/initializers/simple_captcha.rb +70 -0
  100. data/config/locales/en.hancock.yml +29 -0
  101. data/config/locales/en.hancock_admin.yml +6 -0
  102. data/config/locales/ru.cancan.yml +4 -0
  103. data/config/locales/ru.devise.yml +65 -0
  104. data/config/locales/ru.hancock.yml +36 -0
  105. data/config/locales/ru.hancock_admin.yml +6 -0
  106. data/config/locales/ru.models.yml +82 -0
  107. data/config/locales/ru.mongoid.yml +450 -0
  108. data/config/locales/ru.rails_admin.yml +168 -0
  109. data/hancock_cms.gemspec +46 -0
  110. data/lib/filename_to_slug.rb +32 -0
  111. data/lib/generators/hancock/cms/ability_generator.rb +14 -0
  112. data/lib/generators/hancock/cms/admin_generator.rb +21 -0
  113. data/lib/generators/hancock/cms/application_generator.rb +14 -0
  114. data/lib/generators/hancock/cms/assets_generator.rb +35 -0
  115. data/lib/generators/hancock/cms/config_generator.rb +13 -0
  116. data/lib/generators/hancock/cms/controllers/decorators_generator.rb +27 -0
  117. data/lib/generators/hancock/cms/gemfile_generator.rb +13 -0
  118. data/lib/generators/hancock/cms/layout_generator.rb +14 -0
  119. data/lib/generators/hancock/cms/model_generator.rb +39 -0
  120. data/lib/generators/hancock/cms/models/embedded_element_generator.rb +56 -0
  121. data/lib/generators/hancock/cms/models/templates/embedded_element.erb +47 -0
  122. data/lib/generators/hancock/cms/paperclip_optimizer_generator.rb +13 -0
  123. data/lib/generators/hancock/cms/rack_generator.rb +12 -0
  124. data/lib/generators/hancock/cms/robots_generator.rb +14 -0
  125. data/lib/generators/hancock/cms/scripts_generator.rb +31 -0
  126. data/lib/generators/hancock/cms/templates/Gemfile.erb +69 -0
  127. data/lib/generators/hancock/cms/templates/ability.erb +49 -0
  128. data/lib/generators/hancock/cms/templates/admin.erb +74 -0
  129. data/lib/generators/hancock/cms/templates/application.erb +42 -0
  130. data/lib/generators/hancock/cms/templates/assets/javascripts/application.coffee.erb +5 -0
  131. data/lib/generators/hancock/cms/templates/assets/stylesheets/application.sass.erb +88 -0
  132. data/lib/generators/hancock/cms/templates/hancock_cms.erb +30 -0
  133. data/lib/generators/hancock/cms/templates/model.erb +42 -0
  134. data/lib/generators/hancock/cms/templates/paperclip_optimizer.erb +80 -0
  135. data/lib/generators/hancock/cms/templates/rack.erb +15 -0
  136. data/lib/generators/hancock/cms/templates/robots.txt.erb +5 -0
  137. data/lib/generators/hancock/cms/templates/scripts/assets_precompile.sh +3 -0
  138. data/lib/generators/hancock/cms/templates/scripts/bundle_production.sh +4 -0
  139. data/lib/generators/hancock/cms/templates/scripts/db_dump.sh.erb +3 -0
  140. data/lib/generators/hancock/cms/templates/scripts/db_restore.sh +3 -0
  141. data/lib/generators/hancock/cms/templates/scripts/full_assets_precompile.sh +4 -0
  142. data/lib/generators/hancock/cms/templates/scripts/restart_thru_kill.sh +3 -0
  143. data/lib/generators/hancock/cms/templates/scripts/send_hup.sh +3 -0
  144. data/lib/generators/hancock/cms/templates/scripts/send_usr2.sh +3 -0
  145. data/lib/generators/hancock/cms/templates/scripts/server.sh +5 -0
  146. data/lib/generators/hancock/cms/templates/scripts/server_alt.sh +5 -0
  147. data/lib/generators/hancock/cms/templates/unicorn.erb +57 -0
  148. data/lib/generators/hancock/cms/templates/unicorn.god.erb +59 -0
  149. data/lib/generators/hancock/cms/unicorn_god_generator.rb +15 -0
  150. data/lib/generators/hancock/cms/utils.rb +21 -0
  151. data/lib/hancock/admin.rb +60 -0
  152. data/lib/hancock/admin/embedded_element.rb +26 -0
  153. data/lib/hancock/configuration.rb +48 -0
  154. data/lib/hancock/controller.rb +30 -0
  155. data/lib/hancock/engine.rb +48 -0
  156. data/lib/hancock/migration.rb +15 -0
  157. data/lib/hancock/model.rb +53 -0
  158. data/lib/hancock/models/embedded_element.rb +12 -0
  159. data/lib/hancock/models/mongoid/embedded_element.rb +14 -0
  160. data/lib/hancock/plugin.rb +25 -0
  161. data/lib/hancock/plugin_configuration.rb +30 -0
  162. data/lib/hancock/rails_admin_ext/config.rb +129 -0
  163. data/lib/hancock/rails_admin_ext/hancock_hash.rb +84 -0
  164. data/lib/hancock/rails_admin_ext/hancock_html.rb +79 -0
  165. data/lib/hancock/rails_admin_ext/hancock_multiselect.rb +44 -0
  166. data/lib/hancock/rails_admin_ext/hancock_slugs.rb +35 -0
  167. data/lib/hancock/rails_admin_ext/patches/field_patch.rb +14 -0
  168. data/lib/hancock/rails_admin_ext/patches/group_patch.rb +41 -0
  169. data/lib/hancock/rails_admin_ext/patches/hancock_cms_group.rb +61 -0
  170. data/lib/hancock/rails_admin_ext/patches/new_controller_patch.rb +54 -0
  171. data/lib/hancock/routes.rb +20 -0
  172. data/lib/hancock/simple_form_patch.rb +12 -0
  173. data/lib/hancock/tasks.rb +13 -0
  174. data/lib/hancock/version.rb +3 -0
  175. data/lib/hancock_cms.rb +130 -0
  176. data/lib/manual_slug.rb +10 -0
  177. data/lib/manual_slug/active_record.rb +32 -0
  178. data/lib/manual_slug/mongoid.rb +40 -0
  179. data/lib/rails_admin/custom_show_in_app.rb +43 -0
  180. data/release.sh +12 -0
  181. data/template.rb +564 -0
  182. metadata +455 -0
@@ -0,0 +1,29 @@
1
+ en:
2
+ hancock:
3
+ gallery: "Gallery"
4
+ cms: "CMS"
5
+ menu: "Menu"
6
+ settings: 'Settings'
7
+ news: 'News'
8
+ with_final_slash: "should begin with a slash"
9
+ page_url_regex: "Regular expression to check if page is current"
10
+ final_in_menu: "This link is also displayed in menu"
11
+ no_contact_info: "Please enter your phone or email so we could contact you."
12
+ map: 'Map'
13
+ sitemap: 'Sitemap'
14
+ sitemap_data: 'Sitemap data'
15
+ edit: Edit
16
+ send: Send
17
+ format_time: "%-m/%-d/%Y"
18
+ m:
19
+ enabled: 'added to menu "%{menu}"'
20
+ disabled: 'deleted from menu "%{menu}"'
21
+ error: "Error: %{err}"
22
+ no_id: "No ID"
23
+ errors:
24
+ title: "Error %{code}"
25
+ form_expired: "Token expired"
26
+ internal_error: "Internal error"
27
+ internal_error_full: "Internal error: %{klass} %{message}"
28
+ access_denied: "Access denied"
29
+ not_found: 'The requested page was not found on this server'
@@ -0,0 +1,6 @@
1
+ en:
2
+ admin:
3
+ actions:
4
+ custom_show_in_app:
5
+ title: 'Show in app'
6
+ menu: "Show in app"
@@ -0,0 +1,4 @@
1
+ en:
2
+ unauthorized:
3
+ manage:
4
+ all: "У вас нет прав на действие %{action} над %{subject}."
@@ -0,0 +1,65 @@
1
+ ru:
2
+ devise:
3
+ confirmations:
4
+ confirmed: Ваша учётная запись подтверждена. Теперь вы вошли в систему.
5
+ send_instructions: В течение нескольких минут вы получите письмо с инструкциями по подтверждению вашей учётной записи.
6
+ send_paranoid_instructions: Если ваш адрес e-mail есть в нашей базе данных, то в течение нескольких минут вы получите письмо с инструкциями по подтверждению вашей учётной записи.
7
+ failure:
8
+ already_authenticated: Вы уже вошли в систему.
9
+ inactive: Ваша учётная запись ещё не активирована.
10
+ invalid: Неверный адрес e-mail или пароль.
11
+ invalid_token: Неверный ключ аутентификации.
12
+ locked: Ваша учётная запись заблокирована.
13
+ not_found_in_database: Неверный адрес e-mail или пароль.
14
+ timeout: Ваш сеанс закончился. Пожалуйста, войдите в систему снова.
15
+ unauthenticated: Вам необходимо войти в систему или зарегистрироваться.
16
+ unconfirmed: Вы должны подтвердить вашу учётную запись.
17
+ mailer:
18
+ confirmation_instructions:
19
+ subject: Инструкции по подтверждению учётной записи
20
+ reset_password_instructions:
21
+ subject: Инструкции по восстановлению пароля
22
+ unlock_instructions:
23
+ subject: Инструкции по разблокировке учётной записи
24
+ omniauth_callbacks:
25
+ failure: Вы не можете войти в систему с учётной записью из %{kind}, т.к. "%{reason}".
26
+ success: Вход в систему выполнен с учётной записью из %{kind}.
27
+ passwords:
28
+ no_token: Доступ к этой странице возможен только по ссылке из письма о восстановлении пароля. Если Вы пришли по такой ссылке, пожалуйста убедитесь что Вы скопировали всю ссылку целиком.
29
+ send_instructions: В течение нескольких минут вы получите письмо с инструкциями по восстановлению вашего пароля.
30
+ send_paranoid_instructions: Если ваш адрес e-mail есть в нашей базе данных, то в течение нескольких минут вы получите письмо с инструкциями по восстановлению вашего пароля.
31
+ updated: Ваш пароль изменён. Теперь вы вошли в систему.
32
+ updated_not_active: Ваш пароль изменен.
33
+ registrations:
34
+ destroyed: До свидания! Ваша учётная запись удалена. Надеемся снова увидеть вас.
35
+ signed_up: Добро пожаловать! Вы успешно зарегистрировались.
36
+ signed_up_but_inactive: Вы успешно зарегистрированы. Однако, вы не можете войти в систему, потому что ваша учетная запись не активирована.
37
+ signed_up_but_locked: Вы успешно зарегистрированы. Однако, вы не можете войти в систему, потому что ваша учетная запись заблокирована.
38
+ signed_up_but_unconfirmed: Письмо со ссылкой для подтверждения было отправлено на ваш e-mail. Пожалуйста, перейдите по ссылке, чтобы подтвердить вашу учетную запись.
39
+ update_needs_confirmation: Вы успешно обновили данные вашей учетной записи, но нам нужно проверить ваш новый адрес e-mail. Пожалуйста, проверьте ваш почтовый ящик и перейдите по ссылке, чтобы закончить процедуру проверки вашего нового адреса e-mail.
40
+ updated: Ваша учётная запись изменена.
41
+ sessions:
42
+ signed_in: Вход в систему выполнен.
43
+ signed_out: Выход из системы выполнен.
44
+ unlocks:
45
+ send_instructions: В течение нескольких минут вы получите письмо с инструкциями по разблокировке вашей учётной записи.
46
+ send_paranoid_instructions: Если ваша учётная запись существует, то в течение нескольких минут вы получите письмо с инструкциями по её разблокировке.
47
+ unlocked: Ваша учётная запись разблокирована. Теперь вы можете войти в систему.
48
+ failure:
49
+ user:
50
+ not_found_in_database: Пользователь не найден в базе
51
+ invalid: Неверный пароль
52
+ unauthenticated: Необходимо авторизоваться
53
+ unconfirmed: 'Необходимо подтвердить адрес электронной почты'
54
+ errors:
55
+ messages:
56
+ already_confirmed: уже подтверждена. Пожалуйста, попробуйте войти в систему
57
+ confirmation_period_expired:
58
+ expired: устарела. Пожалуйста, запросите новую
59
+ not_found: не найдена
60
+ not_locked: не заблокирована
61
+ not_saved:
62
+ few: ! '%{resource}: сохранение не удалось из-за %{count} ошибок'
63
+ many: ! '%{resource}: сохранение не удалось из-за %{count} ошибок'
64
+ one: ! '%{resource}: сохранение не удалось из-за %{count} ошибки'
65
+ other: ! '%{resource}: сохранение не удалось из-за %{count} ошибки'
@@ -0,0 +1,36 @@
1
+ ru:
2
+ hancock:
3
+ url: URL
4
+ content: "Контент"
5
+ cache: Кеширование
6
+ gallery: "Галерея"
7
+ cms: "CMS"
8
+ menu: "Меню"
9
+ settings: 'Настройки'
10
+ with_final_slash: "c начальным слешем"
11
+ page_url_regex: "Регулярное выражение, по которому определяется является ли этот пункт активным"
12
+ final_in_menu: "В меню сразу отдается конечная ссылка"
13
+ map: 'Карта'
14
+ sitemap: 'Карта сайта'
15
+ sitemap_data: 'Данные для карты сайта'
16
+ edit: Редактировать
17
+ send: Отправить
18
+ format_time: "%d.%m.%Y"
19
+ errors:
20
+ title: "Ошибка %{code}"
21
+ form_expired: "Истекло время на заполение формы"
22
+ internal_error: "Внутренняя ошибка"
23
+ internal_error_full: "Внутренняя ошибка: %{klass} %{message}"
24
+ access_denied: "Доступ запрещен"
25
+ not_found: 'Запрашиваемая страница была удалена, или введён некорректный адрес'
26
+
27
+
28
+ shared:
29
+ enter_site: Войти на сайт
30
+ email: E-mail
31
+ password: Пароль
32
+ password_confirmation: Подтвердите пароль
33
+ remember_me: Запомнить меня
34
+ enter: Войти
35
+ registration: Зарегистрироваться
36
+ forget_password: Забыли пароль?
@@ -0,0 +1,6 @@
1
+ ru:
2
+ admin:
3
+ actions:
4
+ custom_show_in_app:
5
+ title: 'На сайте'
6
+ menu: "Показать на сайте"
@@ -0,0 +1,82 @@
1
+ ru:
2
+ attributes:
3
+ user: Пользователь
4
+ name: Название
5
+ category: Раздел
6
+ file: Файл
7
+ short: Короткое описание
8
+ text: Текст
9
+ desc: Описание
10
+ image: Картинка
11
+ href: Ссылка
12
+ enabled: Включено
13
+ slug: URL код
14
+ text_slug: URL код
15
+ created_at: Создано
16
+ updated_at: Обновлено
17
+ id: ID
18
+ content: Содержимое
19
+ time: Время
20
+ excerpt: Превью
21
+ sort: Сортировка
22
+ link: Ссылка
23
+ url: URL
24
+ address: Адрес
25
+ map_address: Адрес для карты
26
+ map_hint: Подсказка для карты
27
+ coordinates: Координаты из геокодирования
28
+ lat: Широта (вручную)
29
+ lon: Долгота (вручную)
30
+ description: SEO Description
31
+ email: Email
32
+ keywords: SEO Keywords
33
+ modifier_id: Кто правил
34
+ og_title: Og title
35
+ robots: Robots
36
+ title: Title
37
+ version: Version
38
+
39
+ sitemap_data_field: Родительский элемент/страница
40
+ seoable: Родительский элемент/страница
41
+ sitemap_show: Отображать в карте сайта
42
+ sitemap_lastmod: lastmod
43
+ sitemap_changefreq: changefreq
44
+ sitemap_priority: priority
45
+
46
+ cache_keys_str: Ключи кэша
47
+ perform_caching: Кэшировать?
48
+
49
+ mongoid: &mongoid
50
+ models:
51
+ user: Пользователь
52
+ attributes:
53
+ user:
54
+ email: E-mail
55
+ name: ФИО
56
+ login: Логин
57
+ roles: "Права доступа"
58
+ old_password: Текущий пароль
59
+ password: Пароль
60
+ password_confirmation: Подтвердите пароль
61
+ remember_me: Запомнить
62
+ c_at: Создан
63
+ current_sign_in_ip: Текущий IP
64
+ last_sign_in_ip: Прошлый IP
65
+ first_name: Имя
66
+ last_name: Фамилия
67
+ phone: Телефон
68
+
69
+ activerecord:
70
+ <<: *mongoid
71
+
72
+ activemodel:
73
+ errors:
74
+ messages:
75
+ invalid_email_address: "Неверный e-mail"
76
+
77
+ admin:
78
+ scopes:
79
+ by_date: "По времени"
80
+ sorted: "Сортированные"
81
+ enabled: "Доступные"
82
+ _all: "Все"
@@ -0,0 +1,450 @@
1
+ ru:
2
+ mongoid:
3
+ errors:
4
+ messages:
5
+ blank_in_locale:
6
+ "can't be blank in %{location}"
7
+ ambiguous_relationship:
8
+ message: "Ambiguous relations %{candidates} defined on %{klass}."
9
+ summary:
10
+ "When Mongoid attempts to set an inverse document of a relation
11
+ in memory, it needs to know which relation it belongs to. When
12
+ setting %{name}, Mongoid looked on the class %{inverse}
13
+ for a matching relation, but multiples were found that could
14
+ potentially match: %{candidates}."
15
+ resolution: "On the %{name} relation on %{inverse} you must add an
16
+ :inverse_of option to specify the exact relationship on %{klass}
17
+ that is the opposite of %{name}."
18
+ callbacks:
19
+ message: "Calling %{method} on %{klass} resulted in a false return
20
+ from a callback."
21
+ summary: "If a before callback returns false when using Document.create!,
22
+ Document#save!, or Documnet#update_attributes! this error will get raised
23
+ since the document did not actually get saved."
24
+ resolution: "Double check all before callbacks to make sure they are
25
+ not unintentionally returning false."
26
+ calling_document_find_with_nil_is_invalid:
27
+ message: "Calling Document.find with nil is invalid."
28
+ summary: "Document.find expects the parameters to be 1 or more ids, and
29
+ will return a single document if 1 id is provided, otherwise an array
30
+ of documents if multiple ids are provided."
31
+ resolution: "Most likely this is caused by passing parameters directly
32
+ through to the find, and the parameter either is not present or the
33
+ key from which it is accessed is incorrect."
34
+ document_not_found:
35
+ message: "Document(s) not found for class %{klass} with id(s) %{missing}."
36
+ summary: "When calling %{klass}.find with an id or array of ids, each
37
+ parameter must match a document in the database or this error will be
38
+ raised. The search was for the id(s): %{searched} (%{total} total)
39
+ and the following ids were not found: %{missing}."
40
+ resolution: "Search for an id that is in the database or set
41
+ the Mongoid.raise_not_found_error configuration option to false,
42
+ which will cause a nil to be returned instead of raising this error when
43
+ searching for a single id, or only the matched documents when searching
44
+ for multiples."
45
+ document_with_attributes_not_found:
46
+ message: "Document not found for class %{klass} with attributes %{attributes}."
47
+ summary: "When calling %{klass}.find_by with a hash of attributes, all
48
+ attributes provided must match a document in the database or this error
49
+ will be raised."
50
+ resolution: "Search for attributes that are in the database or set
51
+ the Mongoid.raise_not_found_error configuration option to false,
52
+ which will cause a nil to be returned instead of raising this error."
53
+ eager_load:
54
+ message: "Eager loading :%{name} is not supported since it is a
55
+ polymorphic belongs_to relation."
56
+ summary: "Mongoid cannot currently determine the classes it needs to
57
+ eager load when the relation is polymorphic. The parents reside in
58
+ different collections so a simple id lookup is not sufficient enough."
59
+ resolution: "Don't attempt to perform this action and have patience,
60
+ maybe this will be supported in the future."
61
+ invalid_collection:
62
+ message: "Access to the collection for %{klass} is not allowed."
63
+ summary: "%{klass}.collection was called, and %{klass} is an embedded
64
+ document - it resides within the collection of the root document of
65
+ the hierarchy."
66
+ resolution: "For access to the collection that the embedded document is
67
+ in, use %{klass}#_root.collection, or do not attempt to persist an
68
+ embedded document without a parent set."
69
+ invalid_config_option:
70
+ message: "Invalid configuration option: %{name}."
71
+ summary: "A invalid configuration option was provided in your
72
+ mongoid.yml, or a typo is potentially present. The valid configuration
73
+ options are: %{options}."
74
+ resolution: "Remove the invalid option or fix the typo. If you were
75
+ expecting the option to be there, please consult the following page
76
+ with repect to Mongoid's configuration:\n\n
77
+ \_\_http://mongoid.org/en/mongoid/docs/installation.html"
78
+ invalid_field:
79
+ message: "Defining a field named '%{name}' is not allowed."
80
+ summary: "Defining this field would override the method '%{name}',
81
+ which would cause issues with expectations around the original
82
+ method and cause extremely hard to debug issues. The original
83
+ method was defined in:\n
84
+ \_\_Object: %{origin}\n
85
+ \_\_File: %{file}\n
86
+ \_\_Line: %{line}"
87
+ resolution: "Use Mongoid.destructive_fields to see what names are not
88
+ allowed, and don't use these names. These include names that also
89
+ conflict with core Ruby methods on Object, Module, Enumerable, or
90
+ included gems that inject methods into these or Mongoid internals."
91
+ invalid_field_option:
92
+ message: "Invalid option :%{option} provided for field :%{name}."
93
+ summary: "Mongoid requires that you only provide valid options on each
94
+ field definition in order to prevent unexpected behaviour later on."
95
+ resolution: "When defining the field :%{name} on '%{klass}', please provide
96
+ valid options for the field. These are currently: %{valid}. If you
97
+ meant to define a custom field option, please do so first like so:\n\n
98
+ \_\_Mongoid::Fields.option :%{option} do |model, field, value|\n
99
+ \_\_\_\_# Your logic here...\n
100
+ \_\_end\n
101
+ \_\_class %{klass}\n
102
+ \_\_\_\_include Mongoid::Document\n
103
+ \_\_\_\_field :%{name}, %{option}: true\n
104
+ \_\_end\n\n"
105
+ invalid_includes:
106
+ message: "Invalid includes directive: %{klass}.includes(%{args})"
107
+ summary: "Eager loading in Mongoid only supports providing arguments
108
+ to %{klass}.includes that are the names of relations on the %{klass}
109
+ model, and only supports one level of eager loading. (ie, eager loading
110
+ associations not on the %{klass} but one step away via another relation
111
+ is not allowed."
112
+ resolution: "Ensure that each parameter passed to %{klass}.includes is
113
+ a valid name of a relation on the %{klass} model. These are: %{relations}."
114
+ invalid_index:
115
+ message: "Invalid index specification on %{klass}: %{spec}, %{options}"
116
+ summary: "Indexes in Mongoid are defined as a hash of field name and
117
+ direction/2d pairs, with a hash for any additional options."
118
+ resolution: "Ensure that the index conforms to the correct syntax and
119
+ has the correct options.\n\n
120
+ Valid options are:\n
121
+ \_\_background: true|false\n
122
+ \_\_drop_dups: true|false\n
123
+ \_\_name: 'index_name'\n
124
+ \_\_sparse: true|false\n
125
+ \_\_unique: true|false\n
126
+ \_\_min: 1\n
127
+ \_\_max: 1\n
128
+ \_\_bits: 26\n
129
+ \_\_bucket_size : 1\n
130
+ \_\_weights: { content: 1, title: 2 }\n
131
+ Valid types are: 1, -1, '2d', '2dsphere', 'geoHaystack', 'text', 'hashed'\n\n
132
+ Example:\n
133
+ \_\_class Band\n
134
+ \_\_\_\_include Mongoid::Document\n
135
+ \_\_\_\_index({ name: 1, label: -1 }, { sparse: true })\n
136
+ \_\_\_\_index({ location: '2d' }, { background: true })\n
137
+ \_\_end\n\n"
138
+ invalid_options:
139
+ message: "Invalid option :%{invalid} provided to relation :%{name}."
140
+ summary: "Mongoid checks the options that are passed to the relation
141
+ macros to ensure that no ill side effects occur by letting something
142
+ slip by."
143
+ resolution: "Valid options are: %{valid}, make sure these are the ones
144
+ you are using."
145
+ invalid_path:
146
+ message: "Having a root path assigned for %{klass} is invalid."
147
+ summary: "Mongoid has two different path objects for determining
148
+ the location of a document in the database, Root and Embedded.
149
+ This error is raised when an embedded document somehow gets a
150
+ root path assigned."
151
+ resolution: "Most likely your embedded model, %{klass} is also
152
+ referenced via a has_many from a root document in another
153
+ collection. Double check the relation definitions and fix any
154
+ instances where embedded documents are improperly referenced
155
+ from other collections."
156
+ invalid_scope:
157
+ message: "Defining a scope of value %{value} on %{klass} is not
158
+ allowed."
159
+ summary: "Scopes in Mongoid must be either criteria objects or procs
160
+ that wrap criteria objects."
161
+ resolution: "Change the scope to be a criteria or proc wrapped
162
+ critera.\n\n
163
+ Example:\n
164
+ \_\_class Band\n
165
+ \_\_\_\_include Mongoid::Document\n
166
+ \_\_\_\_field :active, type: Boolean, default: true\n
167
+ \_\_\_\_scope :active, where(active: true)\n
168
+ \_\_\_\_scope :inactive, ->{ where(active: false) }\n
169
+ \_\_end\n\n"
170
+ invalid_storage_options:
171
+ message: "Invalid options passed to %{klass}.store_in: %{options}."
172
+ summary: "The :store_in macro takes only a hash of parameters with
173
+ the keys :database, :collection, or :session."
174
+ resolution: "Change the options passed to store_in to match the
175
+ documented API, and ensure all keys in the options hash are
176
+ symbols.\n\n
177
+ Example:\n
178
+ \_\_class Band\n
179
+ \_\_\_\_include Mongoid::Document\n
180
+ \_\_\_\_store_in collection: 'artists', database: 'secondary'\n
181
+ \_\_end\n\n"
182
+ invalid_time:
183
+ message: "'%{value}' is not a valid Time."
184
+ summary: "Mongoid tries to serialize the values for Date, DateTime, and
185
+ Time into proper UTC times to store in the database. The provided
186
+ value could not be parsed."
187
+ resolution: "Make sure to pass parsable values to the field setter
188
+ for Date, DateTime, and Time objects. When this is a String it needs
189
+ to be valid for Time.parse. Other objects must be valid to pass to
190
+ Time.local."
191
+ inverse_not_found:
192
+ message: "When adding a(n) %{klass} to %{base}#%{name}, Mongoid could
193
+ not determine the inverse foreign key to set. The attempted key was
194
+ '%{inverse}'."
195
+ summary: "When adding a document to a relation, Mongoid attempts
196
+ to link the newly added document to the base of the relation in
197
+ memory, as well as set the foreign key to link them on the
198
+ database side. In this case Mongoid could not determine what the
199
+ inverse foreign key was."
200
+ resolution: "If an inverse is not required, like a belongs_to or
201
+ has_and_belongs_to_many, ensure that :inverse_of => nil is set
202
+ on the relation. If the inverse is needed, most likely the
203
+ inverse cannot be figured out from the names of the relations and
204
+ you will need to explicitly tell Mongoid on the relation what
205
+ the inverse is.\n\n
206
+ Example:\n
207
+ \_\_class Lush\n
208
+ \_\_\_\_include Mongoid::Document\n
209
+ \_\_\_\_has_one :whiskey, class_name: \"Drink\", inverse_of: :alcoholic\n
210
+ \_\_end\n\n
211
+ \_\_class Drink\n
212
+ \_\_\_\_include Mongoid::Document\n
213
+ \_\_\_\_belongs_to :alcoholic, class_name: \"Lush\", inverse_of: :whiskey\n
214
+ \_\_end"
215
+ invalid_set_polymorphic_relation:
216
+ message: "The %{name} attribute can't be set to an instance of
217
+ %{other_klass} as %{other_klass} has multiple relations referencing
218
+ %{klass} as %{name}."
219
+ summary: "If the parent class of a polymorphic relation has multiple
220
+ definitions for the same relation, the values must be set from the
221
+ parent side and not the child side since Mongoid cannot determine
222
+ from the child side which relation to go in."
223
+ resolution: "Set the values from the parent, or redefine the relation
224
+ with only a single definition in the parent."
225
+ invalid_value:
226
+ message: "Value of type %{value_class} cannot be written to a field of type %{field_class}"
227
+ summary: "Tried to set a value of type %{value_class} to a field of type %{field_class}"
228
+ resolution: "Verify if the value to be set correspond to field definition"
229
+ mixed_relations:
230
+ message: "Referencing a(n) %{embedded} document from the %{root}
231
+ document via a relational association is not allowed since the
232
+ %{embedded} is embedded."
233
+ summary: "In order to properly access a(n) %{embedded} from %{root}
234
+ the reference would need to go through the root document of
235
+ %{embedded}. In a simple case this would require Mongoid to store
236
+ an extra foreign key for the root, in more complex cases where
237
+ %{embedded} is multiple levels deep a key would need to be stored
238
+ for each parent up the hierarchy."
239
+ resolution: "Consider not embedding %{embedded}, or do the key
240
+ storage and access in a custom manner in the application code."
241
+ mixed_session_configuration:
242
+ message: "Both uri and standard configuration options defined for
243
+ session: '%{name}'."
244
+ summary: "Instead of simply giving uri or standard options a
245
+ preference order, Mongoid assumes that you have made a mistake in
246
+ your configuration and requires that you provide one or the other,
247
+ but not both. The options that were provided were: %{config}."
248
+ resolution: "Provide either only a uri as configuration or only
249
+ standard options."
250
+ nested_attributes_metadata_not_found:
251
+ message: "Could not find metadata for relation '%{name}' on model:
252
+ %{klass}."
253
+ summary: "When defining nested attributes for a relation, Mongoid
254
+ needs to access the metadata for the relation '%{name}' in order
255
+ if add autosave functionality to it, if applicable. Either no
256
+ relation named '%{name}' could be found, or the relation had not
257
+ been defined yet."
258
+ resolution: "Make sure that there is a relation defined named
259
+ '%{name}' on %{klass} or that the relation definition comes before
260
+ the accepts_nested_attributes_for macro in the model - order
261
+ matters so that Mongoid has access to the metadata.\n\n
262
+ Example:\n
263
+ \_\_class Band\n
264
+ \_\_\_\_include Mongoid::Document\n
265
+ \_\_\_\_has_many :albums\n
266
+ \_\_\_\_accepts_nested_attributes_for :albums\n
267
+ \_\_end\n\n"
268
+ no_default_session:
269
+ message: "No default session configuration is defined."
270
+ summary: "The configuration provided settings for: %{keys}, but
271
+ Mongoid requires a :default to be defined at minimum."
272
+ resolution: "If configuring via a mongoid.yml, ensure that within
273
+ your :sessions section a :default session is defined.\n\n
274
+ Example:\n
275
+ \_\_development:\n
276
+ \_\_\_\_sessions:\n
277
+ \_\_\_\_\_\_default:\n
278
+ \_\_\_\_\_\_\_\_hosts:\n
279
+ \_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
280
+ no_environment:
281
+ message: "Could not load the configuration since no environment
282
+ was defined."
283
+ summary: "Mongoid attempted to find the appropriate environment
284
+ but no Rails.env, Sinatra::Base.environment, RACK_ENV, or
285
+ MONGOID_ENV could be found."
286
+ resolution: "Make sure some environment is set from the mentioned
287
+ options. Mongoid cannot load configuration from the yaml without
288
+ knowing which environment it is in, and we have considered
289
+ defaulting to development an undesireable side effect of this not
290
+ being defined."
291
+ no_map_reduce_output:
292
+ message: "No output location was specified for the map/reduce
293
+ operation."
294
+ summary: "When executing a map/reduce, you must provide the output
295
+ location of the results. The attempted command was: %{command}."
296
+ resolution: "Provide the location that the output of the operation
297
+ is to go by chaining an #out call to the map/reduce.\n\n
298
+ Example:\n
299
+ \_\_Band.map_reduce(map, reduce).out(inline: 1)\n\n
300
+ Valid options for the out function are:\n
301
+ \_\_inline: 1\n
302
+ \_\_merge: 'collection-name'\n
303
+ \_\_replace: 'collection-name'\n
304
+ \_\_reduce: 'collection-name'\n\n"
305
+ no_metadata:
306
+ message: "Metadata not found for document of type %{klass}."
307
+ summary: "Mongoid sets the metadata of a relation on the document
308
+ when it is either loaded from within the relation, or added to
309
+ one. The presence of the metadata is required in order to
310
+ provide various functionality around relations. Most likely you
311
+ are getting this error because the document is embedded and was
312
+ attempted to be persisted without being associated with a parent,
313
+ or the relation was not properly defined."
314
+ resolution: "Ensure that your relations on the %{klass} model
315
+ are all properly defined, and that the inverse relations
316
+ are also properly defined. Embedded relations must have both the
317
+ parent (embeds_one/embeds_many) and the inverse (embedded_in)
318
+ present in order to work properly."
319
+ no_parent:
320
+ message: "Cannot persist embedded document %{klass} without a
321
+ parent document."
322
+ summary: "If the document is embedded, in order to be persisted it
323
+ must always have a reference to its parent document. This is
324
+ most likely caused by either calling %{klass}.create or
325
+ %{klass}.create! without setting the parent document as an
326
+ attribute."
327
+ resolution: "Ensure that you've set the parent relation if
328
+ instantiating the embedded document direcly, or always create new
329
+ embedded documents via the parent relation."
330
+ no_session_config:
331
+ message: "No configuration could be found for a session named
332
+ '%{name}'."
333
+ summary: "When attempting to create the new session, Mongoid could
334
+ not find a session configuration for the name: '%{name}'. This is
335
+ necessary in order to know the host, port, and options needed
336
+ to connect."
337
+ resolution: "Double check your mongoid.yml to make sure under the
338
+ sessions key that a configuration exists for '%{name}'. If you
339
+ have set the configuration programatically, ensure that '%{name}'
340
+ exists in the configuration hash."
341
+ no_sessions_config:
342
+ message: "No sessions configuration provided."
343
+ summary: "Mongoid's configuration requires that you provide details
344
+ about each session that can be connected to, and requires in
345
+ the sessions config at least 1 default session to exist."
346
+ resolution: "Double check your mongoid.yml to make sure that you
347
+ have a top-level sessions key with at least 1 default session
348
+ configuration for it. You can regenerate a new mongoid.yml for
349
+ assistance via `rails g mongoid:config`.\n\n
350
+ Example:\n
351
+ \_\_development:\n
352
+ \_\_\_\_sessions:\n
353
+ \_\_\_\_\_\_default:\n
354
+ \_\_\_\_\_\_\_\_database: mongoid_dev\n
355
+ \_\_\_\_\_\_\_\_hosts:\n
356
+ \_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
357
+ no_session_database:
358
+ message: "No database provided for session configuration: :%{name}."
359
+ summary: "Each session configuration must provide a database so Mongoid
360
+ knows where the default database to persist to. What was provided
361
+ was: %{config}."
362
+ resolution: "If configuring via a mongoid.yml, ensure that within
363
+ your :%{name} section a :database value for the session's default
364
+ database is defined.\n\n
365
+ Example:\n
366
+ \_\_development:\n
367
+ \_\_\_\_sessions:\n
368
+ \_\_\_\_\_\_%{name}:\n
369
+ \_\_\_\_\_\_\_\_database: my_app_db\n
370
+ \_\_\_\_\_\_\_\_hosts:\n
371
+ \_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
372
+ no_session_hosts:
373
+ message: "No hosts provided for session configuration: :%{name}."
374
+ summary: "Each session configuration must provide hosts so Mongoid
375
+ knows where the database server is located. What was provided
376
+ was: %{config}."
377
+ resolution: "If configuring via a mongoid.yml, ensure that within
378
+ your :%{name} section a :hosts value for the session hosts is
379
+ defined.\n\n
380
+ Example:\n
381
+ \_\_development:\n
382
+ \_\_\_\_sessions:\n
383
+ \_\_\_\_\_\_%{name}:\n
384
+ \_\_\_\_\_\_\_\_database: my_app_db\n
385
+ \_\_\_\_\_\_\_\_hosts:\n
386
+ \_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
387
+ readonly_attribute:
388
+ message: "Attempted to set the readonly attribute '%{name}' with
389
+ the value: %{value}."
390
+ summary: "Attributes flagged as readonly via Model.attr_readonly
391
+ can only have values set when the document is a new record."
392
+ resolution: "Don't define '%{name}' as readonly, or do not attempt
393
+ to update its value after the document is persisted."
394
+ scope_overwrite:
395
+ message: "Cannot create scope :%{scope_name}, because of existing
396
+ method %{model_name}.%{scope_name}."
397
+ summary: "When defining a scope that conflicts with a method that
398
+ already exists on the model, this error will get raised if
399
+ Mongoid.scope_overwrite_exception is set to true."
400
+ resolution: "Change the name of the scope so it does not conflict
401
+ with the already defined method %{model_name}, or set the
402
+ configuration option Mongoid.scope_overwrite_exception to false,
403
+ which is its default. In this case a warning will be logged."
404
+ too_many_nested_attribute_records:
405
+ message: "Accepting nested attributes for %{association} is limited
406
+ to %{limit} records."
407
+ summary: "More documents were sent to be processed than the allowed
408
+ limit."
409
+ resolution: "The limit is set as an option to the macro, for example:
410
+ accepts_nested_attributes_for :%{association}, limit: %{limit}.
411
+ Consider raising this limit or making sure no more are sent than
412
+ the set value."
413
+ unknown_attribute:
414
+ message: "Attempted to set a value for '%{name}' which is not
415
+ allowed on the model %{klass}."
416
+ summary: "Without including Mongoid::Attributes::Dynamic in your model
417
+ and the attribute does not already exist in the attributes hash,
418
+ attempting to call %{klass}#%{name}= for it is not allowed. This is
419
+ also triggered by passing the attribute to any method that accepts an
420
+ attributes hash, and is raised instead of getting a NoMethodError."
421
+ resolution: "You can include Mongoid::Attributes::Dynamic if you
422
+ expect to be writing values for undefined fields often."
423
+ unsaved_document:
424
+ message: "Attempted to save %{document} before the parent %{base}."
425
+ summary: "You cannot call create or create! through the
426
+ relation (%{document}) who's parent (%{base}) is
427
+ not already saved. This would case the database to be out of sync
428
+ since the child could potentially reference a nonexistant parent."
429
+ resolution: "Make sure to only use create or create! when the parent
430
+ document %{base} is persisted."
431
+ unsupported_javascript:
432
+ message: "Executing Javascript $where selector on an embedded criteria
433
+ is not supported."
434
+ summary: "Mongoid only supports providing a hash of arguments to
435
+ #where criterion on embedded documents. Since %{klass} is embedded,
436
+ the expression %{javascript} is not allowed."
437
+ resolution: "Please provide a standard hash to #where when the criteria
438
+ is for an embedded relation."
439
+ validations:
440
+ message: "Validation of %{document} failed."
441
+ summary: "The following errors were found: %{errors}"
442
+ resolution: "Try persisting the document with valid data or remove
443
+ the validations."
444
+ delete_restriction:
445
+ message: "Cannot delete %{document} because of dependent '%{relation}'."
446
+ summary: "When defining '%{relation}' with a :dependent => :restrict,
447
+ Mongoid will raise an error when attempting to delete the
448
+ %{document} when the child '%{relation}' still has documents in it."
449
+ resolution: "Don't attempt to delete the parent %{document} when
450
+ it has children, or change the dependent option on the relation."