enjoy_cms 0.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.rspec +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +5 -0
  7. data/Gemfile.lock +249 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +137 -0
  10. data/Rakefile +1 -0
  11. data/app/assets/javascripts/enjoy_cms.coffee +6 -0
  12. data/app/assets/javascripts/enjoy_cms/flash.js.coffee +3 -0
  13. data/app/assets/javascripts/enjoy_cms/map.js.coffee +22 -0
  14. data/app/assets/javascripts/head.load.js +707 -0
  15. data/app/assets/javascripts/jquery.placeholder.js +157 -0
  16. data/app/assets/stylesheets/enjoy_cms.sass +5 -0
  17. data/app/assets/stylesheets/enjoy_cms/flash.sass +63 -0
  18. data/app/assets/stylesheets/enjoy_cms/normalize.scss +406 -0
  19. data/app/assets/stylesheets/enjoy_cms/powered.sass +18 -0
  20. data/app/controllers/concerns/enjoy/errors.rb +93 -0
  21. data/app/controllers/concerns/enjoy/fancybox.rb +14 -0
  22. data/app/controllers/concerns/enjoy/localizeable.rb +33 -0
  23. data/app/controllers/concerns/enjoy/nav_menu.rb +64 -0
  24. data/app/controllers/concerns/enjoy/no_cache.rb +12 -0
  25. data/app/controllers/concerns/enjoy/seo_pages.rb +83 -0
  26. data/app/controllers/enjoy/contacts_controller.rb +5 -0
  27. data/app/controllers/enjoy/home_controller.rb +6 -0
  28. data/app/controllers/enjoy/news_controller.rb +5 -0
  29. data/app/controllers/enjoy/pages_controller.rb +5 -0
  30. data/app/controllers/enjoy/search_controller.rb +6 -0
  31. data/app/helpers/enjoy/gzip_helper.rb +27 -0
  32. data/app/helpers/enjoy/powered_helper.rb +12 -0
  33. data/app/mailers/enjoy/contact_mailer.rb +17 -0
  34. data/app/models/concerns/enjoy/boolean_field.rb +17 -0
  35. data/app/models/concerns/enjoy/enableable.rb +8 -0
  36. data/app/models/concerns/enjoy/geocodeable.rb +4 -0
  37. data/app/models/concerns/enjoy/mappable.rb +95 -0
  38. data/app/models/concerns/enjoy/mongoid_paperclip.rb +37 -0
  39. data/app/models/concerns/enjoy/seoable.rb +36 -0
  40. data/app/models/concerns/enjoy/sitemap_data.rb +23 -0
  41. data/app/models/concerns/enjoy/sort_field.rb +20 -0
  42. data/app/models/concerns/enjoy/sortable.rb +8 -0
  43. data/app/models/enjoy/contact_message.rb +12 -0
  44. data/app/models/enjoy/embedded_element.rb +15 -0
  45. data/app/models/enjoy/embedded_gallery_image.rb +15 -0
  46. data/app/models/enjoy/gallery.rb +10 -0
  47. data/app/models/enjoy/gallery_image.rb +10 -0
  48. data/app/models/enjoy/menu.rb +12 -0
  49. data/app/models/enjoy/news.rb +12 -0
  50. data/app/models/enjoy/page.rb +12 -0
  51. data/app/models/enjoy/seo.rb +13 -0
  52. data/app/views/blocks/_favicon.html.slim +21 -0
  53. data/app/views/blocks/_footer.html.slim +1 -0
  54. data/app/views/blocks/_seo_block.html.slim +18 -0
  55. data/app/views/blocks/_seo_block_with_obj.html.slim +27 -0
  56. data/app/views/devise/registrations/edit.html.slim +21 -0
  57. data/app/views/devise/registrations/new.html.slim +21 -0
  58. data/app/views/devise/sessions/new.html.slim +22 -0
  59. data/app/views/devise/shared/_links.html.slim +11 -0
  60. data/app/views/enjoy/contact_mailer/new_message_email.html.slim +15 -0
  61. data/app/views/enjoy/contacts/index.html.slim +10 -0
  62. data/app/views/enjoy/contacts/new.html.slim +10 -0
  63. data/app/views/enjoy/contacts/sent.html.slim +4 -0
  64. data/app/views/enjoy/home/index.html.slim +1 -0
  65. data/app/views/enjoy/news/index.html.slim +9 -0
  66. data/app/views/enjoy/news/show.html.slim +8 -0
  67. data/app/views/enjoy/pages/show.html.slim +1 -0
  68. data/app/views/enjoy/search/index.html.slim +19 -0
  69. data/app/views/errors/_base.html.slim +3 -0
  70. data/app/views/errors/error_403.html.slim +1 -0
  71. data/app/views/errors/error_404.html.slim +1 -0
  72. data/app/views/errors/error_500.html.slim +1 -0
  73. data/app/views/layouts/application.html.slim +25 -0
  74. data/app/views/rails_admin/main/_check_boxes.html.slim +27 -0
  75. data/app/views/rails_admin/main/_enum_check_boxes.html.slim +5 -0
  76. data/app/views/rails_admin/main/_enum_radio_buttons.html.slim +5 -0
  77. data/app/views/rails_admin/main/_form_raw.html.slim +1 -0
  78. data/app/views/shared/_admin_link.html.slim +3 -0
  79. data/app/views/shared/_messages.html.slim +7 -0
  80. data/app/views/shared/_meta.html.slim +19 -0
  81. data/app/views/shared/_obj.html.slim +21 -0
  82. data/app/views/shared/_og.html.slim +4 -0
  83. data/app/views/simple_captcha/_simple_captcha.html.slim +12 -0
  84. data/config/initializers/simple_captcha.rb +29 -0
  85. data/config/locales/en.enjoy.yml +29 -0
  86. data/config/locales/en.enjoy_admin.yml +6 -0
  87. data/config/locales/ru.cancan.yml +4 -0
  88. data/config/locales/ru.devise.yml +65 -0
  89. data/config/locales/ru.enjoy.yml +39 -0
  90. data/config/locales/ru.enjoy_admin.yml +6 -0
  91. data/config/locales/ru.kaminari.yml +17 -0
  92. data/config/locales/ru.models.yml +103 -0
  93. data/config/locales/ru.mongoid.yml +450 -0
  94. data/config/locales/ru.rails_admin.yml +148 -0
  95. data/config/locales/ru.simple_captcha.yml +3 -0
  96. data/config/locales/ru.simple_form.yml +9 -0
  97. data/config/routes.rb +14 -0
  98. data/enjoy_cms.gemspec +53 -0
  99. data/lib/enjoy/admin.rb +350 -0
  100. data/lib/enjoy/admin/contact_message.rb +36 -0
  101. data/lib/enjoy/admin/embedded_element.rb +11 -0
  102. data/lib/enjoy/admin/embedded_gallery_image.rb +15 -0
  103. data/lib/enjoy/admin/gallery.rb +20 -0
  104. data/lib/enjoy/admin/gallery_image.rb +18 -0
  105. data/lib/enjoy/admin/menu.rb +27 -0
  106. data/lib/enjoy/admin/news.rb +57 -0
  107. data/lib/enjoy/admin/page.rb +81 -0
  108. data/lib/enjoy/admin/seo.rb +17 -0
  109. data/lib/enjoy/configuration.rb +73 -0
  110. data/lib/enjoy/controller.rb +31 -0
  111. data/lib/enjoy/controllers/contacts.rb +70 -0
  112. data/lib/enjoy/controllers/news.rb +36 -0
  113. data/lib/enjoy/controllers/pages.rb +22 -0
  114. data/lib/enjoy/controllers/search.rb +62 -0
  115. data/lib/enjoy/elastic_search.rb +31 -0
  116. data/lib/enjoy/engine.rb +46 -0
  117. data/lib/enjoy/migration.rb +34 -0
  118. data/lib/enjoy/model.rb +22 -0
  119. data/lib/enjoy/models/active_record/contact_message.rb +14 -0
  120. data/lib/enjoy/models/active_record/menu.rb +17 -0
  121. data/lib/enjoy/models/active_record/news.rb +26 -0
  122. data/lib/enjoy/models/active_record/page.rb +20 -0
  123. data/lib/enjoy/models/active_record/seo.rb +17 -0
  124. data/lib/enjoy/models/contact_message.rb +37 -0
  125. data/lib/enjoy/models/embedded_element.rb +12 -0
  126. data/lib/enjoy/models/embedded_gallery_image.rb +16 -0
  127. data/lib/enjoy/models/gallery.rb +29 -0
  128. data/lib/enjoy/models/gallery_image.rb +23 -0
  129. data/lib/enjoy/models/menu.rb +28 -0
  130. data/lib/enjoy/models/mongoid/contact_message.rb +20 -0
  131. data/lib/enjoy/models/mongoid/embedded_element.rb +13 -0
  132. data/lib/enjoy/models/mongoid/embedded_gallery_image.rb +19 -0
  133. data/lib/enjoy/models/mongoid/gallery.rb +23 -0
  134. data/lib/enjoy/models/mongoid/gallery_image.rb +21 -0
  135. data/lib/enjoy/models/mongoid/menu.rb +15 -0
  136. data/lib/enjoy/models/mongoid/news.rb +29 -0
  137. data/lib/enjoy/models/mongoid/page.rb +25 -0
  138. data/lib/enjoy/models/mongoid/seo.rb +28 -0
  139. data/lib/enjoy/models/news.rb +58 -0
  140. data/lib/enjoy/models/page.rb +90 -0
  141. data/lib/enjoy/models/seo.rb +22 -0
  142. data/lib/enjoy/patch.rb +58 -0
  143. data/lib/enjoy/rails_admin_menu.rb +145 -0
  144. data/lib/enjoy/simple_form_patch.rb +12 -0
  145. data/lib/enjoy/tasks.rb +13 -0
  146. data/lib/enjoy/version.rb +3 -0
  147. data/lib/enjoy_cms.rb +109 -0
  148. data/lib/filename_to_slug.rb +34 -0
  149. data/lib/generators/enjoy/ability_generator.rb +14 -0
  150. data/lib/generators/enjoy/admin_generator.rb +21 -0
  151. data/lib/generators/enjoy/capify_generator.rb +39 -0
  152. data/lib/generators/enjoy/layout_generator.rb +14 -0
  153. data/lib/generators/enjoy/migration_generator.rb +18 -0
  154. data/lib/generators/enjoy/templates/Capfile +17 -0
  155. data/lib/generators/enjoy/templates/ability.erb +26 -0
  156. data/lib/generators/enjoy/templates/admin.erb +89 -0
  157. data/lib/generators/enjoy/templates/deploy.erb +47 -0
  158. data/lib/generators/enjoy/templates/dl.erb +30 -0
  159. data/lib/generators/enjoy/templates/migration_contact_messages.rb +15 -0
  160. data/lib/generators/enjoy/templates/migration_news.rb +26 -0
  161. data/lib/generators/enjoy/templates/migration_pages.rb +45 -0
  162. data/lib/generators/enjoy/templates/migration_seos.rb +14 -0
  163. data/lib/generators/enjoy/templates/production.erb +8 -0
  164. data/lib/generators/enjoy/templates/unicorn.erb +66 -0
  165. data/lib/generators/enjoy/utils.rb +21 -0
  166. data/lib/manual_slug.rb +10 -0
  167. data/lib/manual_slug/active_record.rb +32 -0
  168. data/lib/manual_slug/mongoid.rb +36 -0
  169. data/lib/rails_admin/custom_show_in_app.rb +43 -0
  170. data/release.sh +13 -0
  171. data/template.rb +824 -0
  172. metadata +579 -0
@@ -0,0 +1,39 @@
1
+ ru:
2
+ rs:
3
+ gallery: "Галерея"
4
+ cms: "CMS"
5
+ menu: "Меню"
6
+ settings: 'Настройки'
7
+ news: 'Новости'
8
+ with_final_slash: "c начальным слешем"
9
+ page_url_regex: "Регулярное выражение, по которому определяется является ли этот пункт активным"
10
+ final_in_menu: "В меню сразу отдается конечная ссылка"
11
+ no_contact_info: "^Пожалуйста введите Ваш e-mail или телефон, чтобы мы могли связаться с вами."
12
+ map: 'Карта'
13
+ sitemap: 'Карта сайта'
14
+ sitemap_data: 'Данные для карты сайта'
15
+ edit: Редактировать
16
+ send: Отправить
17
+ format_time: "%d.%m.%Y"
18
+ m:
19
+ enabled: 'добавлено в меню "%{menu}"'
20
+ disabled: 'удалено из меню "%{menu}"'
21
+ error: "Ошибка: %{err}"
22
+ no_id: "Не указан ID"
23
+ errors:
24
+ title: "Ошибка %{code}"
25
+ form_expired: "Истекло время на заполение формы"
26
+ internal_error: "Внутренняя ошибка"
27
+ internal_error_full: "Внутренняя ошибка: %{klass} %{message}"
28
+ access_denied: "Доступ запрещен"
29
+ not_found: 'Запрашиваемая страница была удалена, или введён некорректный адрес'
30
+
31
+
32
+ shared:
33
+ enter_site: Войти на сайт
34
+ email: E-mail
35
+ password: Пароль
36
+ remember_me: Запомнить меня
37
+ enter: Войти
38
+ registration: Зарегистрироваться
39
+ forget_password: Забыли пароль?
@@ -0,0 +1,6 @@
1
+ ru:
2
+ admin:
3
+ actions:
4
+ custom_show_in_app:
5
+ title: 'На сайте'
6
+ menu: "Показать на сайте"
@@ -0,0 +1,17 @@
1
+ ru:
2
+ views:
3
+ pagination:
4
+ first: "« Начало"
5
+ last: "Конец »"
6
+ previous: "‹ Предыдущая"
7
+ next: "Следующая ›"
8
+ truncate: "…"
9
+ helpers:
10
+ page_entries_info:
11
+ one_page:
12
+ display_entries:
13
+ zero: "%{entry_name} не найдены"
14
+ one: "Показано <b>1</b> %{entry_name}"
15
+ other: "Показаны <b>все %{count}</b> %{entry_name}"
16
+ more_pages:
17
+ display_entries: "Показаны %{entry_name} <b>%{first}&nbsp;-&nbsp;%{last}</b> из <b>%{total}</b>"
@@ -0,0 +1,103 @@
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
+ mongoid: &mongoid
40
+ models:
41
+ user: Пользователь
42
+ menu: Меню
43
+ page: Страница
44
+ contact_message: Сообщение
45
+ news: Новость
46
+
47
+ gallery: Фотогалерея
48
+ gallery_image: Фото в фотогалерее
49
+ embeddede_gallery_image: Фото в фотогалерее
50
+ attributes:
51
+ user:
52
+ email: E-mail
53
+ name: ФИО
54
+ login: Логин
55
+ roles: "Права доступа"
56
+ old_password: Текущий пароль
57
+ password: Пароль
58
+ password_confirmation: Подтвердите пароль
59
+ remember_me: Запомнить
60
+ c_at: Создан
61
+ current_sign_in_ip: Текущий IP
62
+ last_sign_in_ip: Прошлый IP
63
+ first_name: Имя
64
+ last_name: Фамилия
65
+ phone: Телефон
66
+ page:
67
+ fullpath: URL
68
+ regexp: Подсветка меню
69
+ redirect: Редирект
70
+ image: Картинка
71
+ hidden: Скрытая
72
+ menus: Меню
73
+ sitemap_show: Отображать в карте сайта
74
+ contact_message:
75
+ name: Ваше имя
76
+ email: Ваш е-мейл
77
+ phone: Ваш телефон
78
+ content: Ваше сообщение
79
+ gallery:
80
+ gallery_image:
81
+ gallery: Фотогалерея
82
+ embeddede_gallery_image:
83
+ errors:
84
+ models:
85
+ contact_message:
86
+ attributes:
87
+ email:
88
+ invalid_email_address: "^Неверный e-mail"
89
+ activerecord:
90
+ <<: *mongoid
91
+
92
+ activemodel:
93
+ errors:
94
+ messages:
95
+ invalid_email_address: "^Неверный e-mail"
96
+
97
+ admin:
98
+ scopes:
99
+ by_date: "По времени"
100
+ sorted: "Сортированные"
101
+ enabled: "Доступные"
102
+ _all: "Все"
103
+
@@ -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."