Update seeds.rb with sample user #326

Merged
kiliczsh merged 6 commits from patch-1 into main 2024-02-07 03:24:14 +08:00
kiliczsh commented 2024-02-07 00:34:03 +08:00 (Migrated from github.com)

When the application is installed it is nice to have a default user to get onboard quickly.

rails db:seed
When the application is installed it is nice to have a default user to get onboard quickly. ```bash rails db:seed ```
robzolkos (Migrated from github.com) reviewed 2024-02-07 00:34:03 +08:00
sebastiancaraballo (Migrated from github.com) reviewed 2024-02-07 00:34:03 +08:00
sebastiancaraballo (Migrated from github.com) reviewed 2024-02-07 01:53:35 +08:00
@@ -7,3 +7,11 @@
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
sebastiancaraballo (Migrated from github.com) commented 2024-02-07 01:53:23 +08:00
family = Family.create_or_find_by!(name: "The Smiths")

Maybe: https://apidock.com/rails/ActiveRecord/Relation/create_or_find_by

```suggestion family = Family.create_or_find_by!(name: "The Smiths") ``` Maybe: https://apidock.com/rails/ActiveRecord/Relation/create_or_find_by
robzolkos (Migrated from github.com) approved these changes 2024-02-07 02:11:26 +08:00
robzolkos (Migrated from github.com) left a comment

Thank you! This is much needed! Should we put something in the readme to guide people to its existence?

Thank you! This is much needed! Should we put something in the readme to guide people to its existence?
kiliczsh commented 2024-02-07 02:14:35 +08:00 (Migrated from github.com)

Thank you! This is much needed! Should we put something in the readme to guide people to its existence?

@robzolkos db:setup has seed by default as far as I know so there is no need for general use

> Thank you! This is much needed! Should we put something in the readme to guide people to its existence? @robzolkos db:setup has seed by default as far as I know so there is no need for general use
robzolkos commented 2024-02-07 02:17:06 +08:00 (Migrated from github.com)

db:setup has seed by default

True - but unless a user goes digging into the seed.rb file they won't know how to login to the app. Normally I've seen instructions like

run db:setup - this will setup a test user with login credentials ...... and password .....

> db:setup has seed by default True - but unless a user goes digging into the seed.rb file they won't know how to login to the app. Normally I've seen instructions like run `db:setup` - this will setup a test user with login credentials ...... and password .....
sebastiancaraballo (Migrated from github.com) approved these changes 2024-02-07 02:18:16 +08:00
sebastiancaraballo (Migrated from github.com) left a comment

Nice

Nice
@@ -7,3 +7,11 @@
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
sebastiancaraballo (Migrated from github.com) commented 2024-02-07 02:18:01 +08:00
user = User.create_or_find_by!(first_name: "John", last_name: "Smith", email: "john@smith.com",

same here

```suggestion user = User.create_or_find_by!(first_name: "John", last_name: "Smith", email: "john@smith.com", ``` same here
kiliczsh commented 2024-02-07 02:19:05 +08:00 (Migrated from github.com)

True idea, I need a little bit time to update it as I am on mobile right now.

True idea, I need a little bit time to update it as I am on mobile right now.
Shpigford commented 2024-02-07 02:22:45 +08:00 (Migrated from github.com)

db:setup has seed by default

True - but unless a user goes digging into the seed.rb file they won't know how to login to the app. Normally I've seen instructions like

run db:setup - this will setup a test user with login credentials ...... and password .....

I agree that adding a line to the README would be helpful.

> > db:setup has seed by default > > True - but unless a user goes digging into the seed.rb file they won't know how to login to the app. Normally I've seen instructions like > > run `db:setup` - this will setup a test user with login credentials ...... and password ..... I agree that adding a line to the README would be helpful.
Sign in to join this conversation.