Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork, Commit, Merge - Easy Issue (Rails) #443

Closed
nikohoffren opened this issue Sep 7, 2023 · 0 comments
Closed

Fork, Commit, Merge - Easy Issue (Rails) #443

nikohoffren opened this issue Sep 7, 2023 · 0 comments

Comments

@nikohoffren
Copy link
Member

Fork, Commit, Merge - Easy Issue (Rails)

Create a Simple "Hello, Rails!" App in Ruby on Rails

Note: You don't have ask permission to start solving the issue or get assigned, since these issues are supposed to be always open for new contributors. The actions-user bot will reset the file back to previous state for the next contributor after your commit is merged. So you can just simply start working with the issue right away!

How to get started:

Open the tasks/rails/easy directory from the root of your project.
Then start implementing your solution!

Objective:

Create a basic Ruby on Rails application that displays "Hello, Rails!" when visiting the home page.

Requirements:

  • Set up a new Rails application.
  • Generate a controller called Welcome.
  • Create an action index in the Welcome controller.
  • Add a view for the index action that displays "Hello, Rails!".
  • Set the route for the home page to point to the Welcome#index action.

Instructions:

First, make sure you are in the correct directory:

cd tasks/rails/easy

To create a new Rails application, you can use the following command:

rails new hello_rails

This will create a new directory called hello_rails containing a new Rails application. You can then navigate into your new app's directory:

cd hello_rails

To generate a new controller called Welcome, run:

rails generate controller Welcome

After that, you'll want to edit the app/controllers/welcome_controller.rb file to add an index action. Then, you'll also add a corresponding view in app/views/welcome/index.html.erb that displays "Hello, Rails!".

Finally, you can set the root URL of your application to point to this index action by editing config/routes.rb:

Rails.application.routes.draw do
  root 'welcome#index'
end

Now, you should be able to run your Rails application and see "Hello, Rails!" when you visit http://localhost:3000. To start the server, use:

rails server

To work with this issue, you need to have Ruby and Rails installed to your local machine.
Check out README.md for more instructions of installing Ruby and Rails and how to make a pull request.

Feel free to ask any questions here if you have some problems!

Also, kindly give this project a star to enhance its visibility for new developers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant