You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

2 Días
14 Hrs
44 Min
24 Seg

¿Qué vamos a desarrollar?

18/36
Resources

How to start a Ruby on Rails project?

Starting a Ruby on Rails project may seem challenging at first, but with the right preparation, any developer can master this process. Here I'll walk you through the most important aspects of setting up a basic task management system. We'll start with project creation and the essential setup.

How do I create a new project in Rails?

To get started, open your command console and navigate to the directory where you plan to save your new project. In this case, we will use a previously created directory called coding/platzi. The instruction to create a new project is:

rails new organizer --skip-test --database=postgresql
  • organizer: It is the name of the new project.
  • --skip-test: Avoid setting up automated tests for now.
  • --database=postgresql: Configures PostgreSQL as our database instead of the default SQLite.

What happens when I run the create command?

This command sets up a base directory and file structure for our Rails project. In addition, Rails will take care of installing the libraries needed for the project to work, including the pg library that allows the interaction between ActiveRecord and PostgreSQL.

How do I prepare the frontend of the project?

Once your project is set up, we can improve the appearance of the frontend using popular JavaScript and CSS libraries. We will use the YARN package manager to install:

  • Bootstrap: Improve the GUI.
  • jQuery and Popper: Bootstrap dependencies.
  • Fonts de Roboto: Optimizes the typographic fonts.

The installation of these libraries is done with the following command in the console:

yarn add bootstrap jquery popper.js

How to configure the project's gemfile?

After integrating the JavaScript libraries, we focus on the Gemfile, which manages the gems of our Ruby on Rails project. Use the text editor to modify it. We include essential gems such as:

  • Hamlet: templating system for Rails.
  • SimpleForm: Optimizes the creation of forms.
  • Pry and PryDoc: Facilitates debugging.

Place these gems appropriately according to their environment:

  • Hamlet Rails should be in the development environment.
  • Pry and PryDoc are placed both in the development and test environment.

Finally, we install these gems with:

bundle install

And just like that, we are all set! From here, you can continue detailing the rest of your application, customizing functionalities and adjusting the design according to your needs. As you progress, you'll see that with each step in Ruby on Rails, you're one step closer to becoming a more experienced developer. Keep going!

Contributions 12

Questions 3

Sort by:

Want to see more contributions, questions and answers from the community?

yarn add bootstrap jquery popper.js roboto-fontface

profe sus clases son las mejores, pero en esta añadiría una visualización de como quedaría el proyecto terminado saludos

pensaba que a platzi no le gustaba jquery

Hay un shortcut para la bandera de la base de datos, quedaría así:

rails new organizacion -T -d postgresql

Por si les da error al instalar la gema pg de POSTGRESQL lo más probable es que necesiten esta librería:
sudo apt-get install libpq-dev

Si estas comenzando el curso y la versión que del Rails que vas a utilizar es la 7 o superior, te recomiendo agregues al comando de creacion los flags: `-j esbuild --css bootstrap` para no tener problemas con los estilos más adelante en el proyecto. Esto lo encontré el siguiente artículo: <https://mixandgo.com/learn/ruby-on-rails/how-to-install-bootstrap>

Hola gente aca les dejo el repo del proyecto, por si en algun momento mas adelante lo llegan a necesitar.
Github 👉 repo del proyecto del curso
Saludos y a darle!

Ahora seria bueno el updata pero con react js o vue js

Instalar bootstrap con yarn.

yarn add bootstrap jquery popper.js roboto.fontface

luego nos vamos agregar desde el archivo Gemfile nuestras gemas para instalarlos.

# para cambiar de .erb a .haml
gem 'hamlit'
# par formularios en .haml
gem 'simple_form' 

# ---solo en ambiente de desarrollo
gem 'hamlit-rails'
# para pruebas de bugs
gem 'pry'
gem 'pry-doc'

luego escribir desde consola

bundle install 

yarn bootstrap

Les comparto las líneas que utilicé para montar Yarn en docker:

FROM ruby:2.7.2-buster

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

Si al ejecutar: rails new organizacion -T -d postgresql

obtienes:

sh: 1: node: not found
sh: 1: nodejs: not found
Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/
Exiting!

Debes verificar que tengas instalado nodejs, si estas usando ubuntu 18, esta guia te puede ser util: https://www.digitalocean.com/community/tutorials/como-instalar-node-js-en-ubuntu-18-04-es