What's news ?!

Apr 07

Rails: How to fix "Unpermitted paramater"

To fix a "ActionController :: InvalidAuthenticityToken", 422 request network error, I needed verify the Rails console.

In my case I see a "Unpermitted parameter: :the_parameter" and to fix this add in controller file:


And this resolve my JSON request error.

Apr 01

How to switch a sqlite to postgres db in Rails

If you're trying deploy a Rails application in Heroku and your database is sqlite, you must switch to psql.

How to do this ? Simple:

run $ rails db:system:change --to=postgresql

If you don't have PostgreSQL in your machine, you'll need install. For instructions access the PostgreSQL page.

Others examples:

rails db:system:change --to=mysql
rails db:system:change --to=sqlite3
rails db:system:change --to=oracle
rails db:system:change --to=frontbase
rails db:system:change --to=sqlserver
rails db:system:change --to=jdbc

Mar 31

How to fix a Rails version error in Heroku deploy

Sometimes when I tried to deploy a rails application to Heroku I've the same error like a "The Ruby version you are trying to install does not exist on this stack."

If you go to Heroku help page, you don't will see a simple view to ruby version x heroku stack and how to update a stack version..

So, to resolve this you need go to Heroku console (more > run console) or "$heroku .." in your machine, and run:

$ heroku stack:set heroku-xx

In my case my heroku stack version is 18, so I got with ".. set heroku-18".

Mar 30

The simple of MVC

MVC is the acronym for Model, View and Controller. It's a model of organization to programs and your files, methods and more. In Rails the MVC is defined as:

1. Routes: matchers for the URL that is requested

2. Model: is a database wrapper

3. View: is your response body content

4. Controller: decide how to process a request and define a response

Mar 28

How to HTTP requests work in yout browser ?

- Exists any methods (types of requests): GET, POST, PATCH, DELETE, etc.
- Each method have a status code/response
- In a web page, the HTML has defined in URL + Head + Body

For more information I advise you to acess MDN Guide from Mozilla forum.

Mar 27

Start in HerokuApp

Hello everyone ! Welcome to my daily lessons blog !

On this page you will see my daily learnings. I really want to help you with my mistakes and fixes.

I'm programming in several languages but the focus is in Ruby In Rails.

Also I'm programming in PHP freelance, so exists a possibility to post a learning in this language. At this job I create a data manager, with tables and routes to store files in Google Drive. I'm using a SDK Google Drive API.