You must be wondering why I am writing a blog about Rails 4 even thought it came out nearly 6 months ago.This is mainly because I found some new features and missed some old ones.
One of the most obvious upgrades in rails 4 is that rails now requires ruby 1.9.3+.Which is really great as it helped clean up the core of rails.But as a developer the first change I had to make to my code Strong Parameters.
- Strong Parameters re-enforces security in by only permitting certain variables through the params field.
- Postgres HStore:Using hstore in postgres has become even easier with the native extension for hstore data.We start with enabling the extenstion in the migration.
We create the attr table in the images table as hstore datatype.
- ActiveModel is another important feature in the rails where you can use regular models in rails without the persistence layer.We can even use validations just like a ActiveRecord::Base model.