-
Create a new Rails application
-
Create 2 models
Employee (first_name, last_name, email_address, phone, salary) and Department (name)
-
Display a HTML table to list all employees and their data as below
- Add new column to this table to edit department
Display a HTML table to list all employees and their data as below
Edit Department
should open a modal that lists all available departments in a drop
down. User should be able to select a department from the drop down and update
the employee's department.
The project is built with :
-
Ruby version : Ruby 2.6.0
-
Rails version : Rails 5.2.8.1
To set up the development database for a Rails application, you can include the following instructions in your README file:
Follow these steps to set up the development database for the Rails application:
- Make sure you have Ruby and Rails installed on your system. You can check this by running the following commands in your terminal:
ruby --version
rails --version
- Install the required dependencies by running the following command in the root directory of your Rails application:
bundle install
- Configure the database connection in the
config/database.yml
file. This file contains the database configuration for different environments. Make sure the development section in the file has the correct settings for your database. For example:
development:
adapter: mysql2
database: your_database_name
username: your_username
password: your_password
host: localhost
port: 3306
- Create the development database by running the following command in your terminal:
rails db:create
- Run database migrations to set up the required tables by executing the following command:
rails db:migrate
- (Optional) If you need to seed the development database with sample data, you can create a
db/seeds.rb
file and populate it with the necessary data. Then run the following command to seed the database:
rails db:seed
- Start the Rails development server by running the following command:
rails server
- Access the application in your web browser by visiting
http://localhost:3000/employees
. You should now be able to interact with your Rails application using the development database.
Note: Make sure to replace your_database_name
, your_username
, and your_password
with the actual values for your database configuration.
http://localhost:3000/employees