Posts

Showing posts from May, 2023

Rails Create new Project

Image
 Rails Create New Project first you create a new project commend is:   rails@rails-dell : ~/Desktop$ rails new blog Add the blog folder in file    rails@rails-dell : ~/Desktop$ cd blog rails@rails-dell : ~/Desktop/blog$ Go to visual studio code see And see The rails application:- generate model in rails application:-   rails@rails-dell : ~/Desktop/blog$ rails g model Message title: string description:text See this in the terminal :- invoke  active_record       create    db/migrate/20230213145830_create_messages.rb       create    app/models/message.rb       invoke    test_unit       create      test/models/message_test.rb       create      test/fixtures/messages.yml Let's create migrate   rails@rails-dell : ~/Desktop/blog$ rails db:migrate See this in the terminal :- == 20230213145830 CreateMessages: migratin...

what is devise ? and how to use devise gem

Image
   Q => What is the devise And how to use devise gem in rails ? Devise  is a well known solution for authentication in  Rails  applications. It's full featured (it not only adds authentication but also password recovery, email changing, session timeout, locking, ip tracking, etc.) and can be expanded to add even more (like JWT authentication). Create a new Rails project:    rails new Demo Add the Devise gem to your Gem file:    gem 'devise' Run this commend to install the gem .        $ bundle install Run the Devise installation generator:   rails generate devise:install  Make sure you have defined default url options in your environments files. Open up  config/environments/development.rb  and add this line:   config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } Generate a User model: rails generate devise User Run database migrations: rails db:migrate Customize...