Posted on Leave a comment

How to display text in paragraphs in Rails

A really quick post with some code allowing displaying text in paragraphs in Rails.

I am currently building a simple app for learning languages and yesterday I created for it a blog section with posts. There I want to write article about learning languages and each new line display as separate paragraph.

The following code does this trick. First you split the text into the array and then iterate over it and put each sentence into paragraph. Here’s the code:

Continue reading How to display text in paragraphs in Rails

Posted on 4 Comments

Rails Stripe integration – how to pass amount to the controller

I have recently decided to learn how to write web applications with Ruby on Rails. I am working on a simple app for learning foreign languages called Repeto and a few days ago I wanted to implement Stripe payments. Basically, I want to sell courses and have a course model in the application. There are a few columns in the course table in the database, one of them is ‘price’ with a decimal value. I would like to display a buy button on the course show page. Somebody could click the button, pay with a bank card and access the course.

Continue reading Rails Stripe integration – how to pass amount to the controller