Skip to content

sei-curiosity/hw-week05day04-devise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 

Repository files navigation

hw-week05day04-devise

Devise : https://github.com/plataformatec/devise#getting-started

1 create new app ~> rails new carDevise -d=postgresql

2 Then cd carDevise , create db inside rails

rails db:create

3 Add the following line to your Gemfile file

gem 'devise'

4 In the terminal

bundle install

5 Next, you need to run the generator:

rails generate devise:install

6 Inside file of config/environments/development.rb: insert this line

config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }

7 Ensure you have defined root_url to something in your config/routes.rb

root to: "home#index"

8 Make new Controller called Home home_controller.rb with method called index

9 make new folder called Home ~> inside the folder create file called index.html.erb

10 Inside view put these lines in file layout application.html.erb

   <p class="notice"><%= notice %></p>
   <p class="alert"><%= alert %></p> 

11 Then run rails g devise:views in the terminal to make view pages for all devise ex: sign-up , sign-in ..etc

12 rails generate devise to create model called User

rails generate devise User

13 Then

rails db:migrate

14 Restart the server

  • To see all routes of App in Browser localhost:3000/rails/info/routes

One-To-Many

User ---< Cars

Cars

  • Name
  • Model
  • Year
You can use scaffold

rails g scaffold Car name:string model:string year:string user:references

Resource about Scaffold

Scaffold

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •