-
-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allows you to override the root path directly on a per-instance basis #287
base: main
Are you sure you want to change the base?
Conversation
@@ -132,7 +132,7 @@ def update_view(name, version: nil, sql_definition: nil, revert_to_version: nil, | |||
# @example | |||
# replace_view :engagement_reports, version: 3, revert_to_version: 2 | |||
# | |||
def replace_view(name, version: nil, revert_to_version: nil, materialized: false) | |||
def replace_view(name, version: nil, revert_to_version: nil, materialized: false, root_path: Rails.root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UnusedMethodArgument: Unused method argument - revert_to_version.
Metrics/LineLength: Line is too long. [108/80]
@@ -88,7 +88,7 @@ def drop_view(name, revert_to_version: nil, materialized: false) | |||
# @example | |||
# update_view :engagement_reports, version: 3, revert_to_version: 2 | |||
# | |||
def update_view(name, version: nil, sql_definition: nil, revert_to_version: nil, materialized: false) | |||
def update_view(name, version: nil, sql_definition: nil, revert_to_version: nil, materialized: false, root_path: Rails.root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/ParameterLists: Avoid parameter lists longer than 5 parameters. [6/5]
Lint/UnusedMethodArgument: Unused method argument - revert_to_version.
Metrics/LineLength: Line is too long. [128/80]
@@ -22,7 +22,7 @@ module Statements | |||
# SELECT * FROM users WHERE users.active = 't' | |||
# SQL | |||
# | |||
def create_view(name, version: nil, sql_definition: nil, materialized: false) | |||
def create_view(name, version: nil, sql_definition: nil, materialized: false, root_path: Rails.root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [104/80]
This helps in situations where you are creating or updating views from within a Rails engine. By adding the
root_path
to the statement it will be able to correctly find the file.The
, root_path: Database::Engine.root
is the part that is manually added. I didn't find any method of autodetecting the rails engine so this would have to be manually added after generating the migration.Solves the issue I brought up in #261
create_view
update_view
replace_view