How to check for empty brackets in a string?

Let's say we have a Movie model with "title" attribute and we would like to validate the title for empty brackets. For example: "Some text some text (some text) some text some text" #=> Valid title "Some text some text [some text] some text some text" #=> Valid title "Some text some text {some text} … Continue reading How to check for empty brackets in a string?

Advertisements

How to implement Rails params from the ground up in Ruby?

Hi guys! This time around I am going to show you how to implement Rails params completely from the ground up. As you probably already know, Rails has something called strong parameters. This is a security practice to prevent accidentally allowing users to update sensitive model attributes, for example "admin" flag in user model in … Continue reading How to implement Rails params from the ground up in Ruby?