You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way this auto-polymorphic discovery functions is by analysing all existing types in the
154
+
_type columns of these associations. For instance, let's say you have an images table with the
155
+
columns `imageable_type` and `imageable_id`, and a goal to have the `Image` model get built out
156
+
with `belongs_to :imageable, polymorphic: true`. In that case to properly establish all the
157
+
inverse associations of `has_many :images, as: :imageable` in each appropriate model, then
158
+
whatever schema you choose here needs to have data present in those polymorphic columns that
159
+
represents the full variety of models that should end up getting the `has_many` side of this
160
+
polymorphic association.
130
161
131
162
### 1.b. Installation
132
163
@@ -142,7 +173,22 @@ To configure additional options, such as defining related columns that you want
142
173
143
174
Inside the generated file many options exist, and one of which is `Brick.additional_references` which defines additional foreign key associations, and even shows some suggested ones where possible. By default these are commented out, and by un-commenting the ones you would like (or perhaps even all of them), then it is as if these foreign keys were present to provide referential integrity. If you then start up a `rails c` you'll find that appropriate belongs_to and has_many associations are automatically fleshed out. Even has_many :through associations are provided when possible associative tables are identified -- that is, tables having only foreign keys that refer to other tables.
144
175
145
-
## Problems
176
+
## Issues
177
+
178
+
If you are using Rails 6.0 or Rails 6.1 and see:
179
+
180
+
uninitialized constant _______
181
+
182
+
(Where _______ is the name of some model or controller class you're hoping to reference) then
183
+
in your application.rb file, make sure this configuration setting is in place:
184
+
185
+
config.autoloader = :classic
186
+
187
+
Every effort is given to maintain compatibility with the current version of the Rails ecosystem,
188
+
so if you hit a snag then we'd at least like to understand the situation. Often we'll also offer
189
+
suggestions. Some feature requests will be enteratined, and for things deemed to be outside of
190
+
the scope of The Brick, an attempt to provide useful extensibility will be made such that add-ons
191
+
can be integrated in order to work in tandem with The Brick.
146
192
147
193
Please use GitHub's [issue tracker](https://github.com/lorint/brick/issues).
And once the service is up and running you can connect through socket /tmp/mysql.sock like this:
179
-
mysql -uroot
242
+
Once the MySQL service is up and running you can connect through socket /tmp/mysql.sock like this:
243
+
```
244
+
mysql -uroot
245
+
```
180
246
181
247
And inside this console now create two users with various permissions (these databases do not need to yet exist). Trade out "my_username" with your real username, such as "sally@localhost".
182
248
183
249
CREATE USER my_username@localhost IDENTIFIED BY '';
184
-
GRANT ALL PRIVILEGES ON duty_free_test.* TO my_username@localhost;
185
-
GRANT ALL PRIVILEGES ON duty_free_foo.* TO my_username@localhost;
186
-
GRANT ALL PRIVILEGES ON duty_free_bar.* TO my_username@localhost;
250
+
GRANT ALL PRIVILEGES ON brick_test.* TO my_username@localhost;
251
+
GRANT ALL PRIVILEGES ON brick_foo.* TO my_username@localhost;
252
+
GRANT ALL PRIVILEGES ON brick_bar.* TO my_username@localhost;
187
253
188
254
And then create the user "duty_free" who can only connect locally:
189
255
CREATE USER duty_free@localhost IDENTIFIED BY '';
190
-
GRANT ALL PRIVILEGES ON duty_free_test.* TO duty_free@localhost;
191
-
GRANT ALL PRIVILEGES ON duty_free_foo.* TO duty_free@localhost;
192
-
GRANT ALL PRIVILEGES ON duty_free_bar.* TO duty_free@localhost;
256
+
GRANT ALL PRIVILEGES ON brick_test.* TO duty_free@localhost;
257
+
GRANT ALL PRIVILEGES ON brick_foo.* TO duty_free@localhost;
258
+
GRANT ALL PRIVILEGES ON brick_bar.* TO duty_free@localhost;
193
259
EXIT
194
260
195
261
Now you should be able to set up the test database for MySQL with:
0 commit comments