Module: ThemeSettingsMigrationsRunner::Helpers
- Extended by:
- Helpers
- Included in:
- Helpers
- Defined in:
- app/services/theme_settings_migrations_runner.rb
Overview
Methods defined in this module will be made available in the JS context where the theme settings migrations are executed.
Defining a method ‘get_category_id_by_name` will result in the `getCategoryIdByName` function being made available in the JS context that migrations are ran in.
Instance Method Summary collapse
-
#get_category_id_by_name(category_name) ⇒ Integer|nil
The id of the category with the given name or nil if a category does not exist for the given name.
-
#is_valid_url(url) ⇒ Boolean
True if the URL is a valid URL or path, false otherwise.
Instance Method Details
#get_category_id_by_name(category_name) ⇒ Integer|nil
Returns The id of the category with the given name or nil if a category does not exist for the given name.
15 16 17 |
# File 'app/services/theme_settings_migrations_runner.rb', line 15 def get_category_id_by_name(category_name) Category.where("name_lower = LOWER(?)", category_name).pick(:id) end |
#is_valid_url(url) ⇒ Boolean
Returns True if the URL is a valid URL or path, false otherwise.
21 22 23 |
# File 'app/services/theme_settings_migrations_runner.rb', line 21 def is_valid_url(url) UrlHelper.is_valid_url?(url) end |