New in Rails 5.1.1

Chandan Jhunjhunwal

24-06-2017

https://github.com/indyarocks/
@ChandanJ

Major Changes

  1. Removal of deprecated functionalities and other notable changes
  2. Rich Javascript libraries with Yarn
  3. Removal of default dependency of JQuery
  4. Webpack for SPA
  5. Safe secrets
  6. Direct and Resolve routes
  7. form_with tag
  8. System test integration
  9. Parameterized mailers

Notable Changes

  • PostgreSQL & MySQL: Use big integer as primary key type for new tables.
     

  • Add :default option to belongs_to
    Use it to specify that an association should be initialized with a particular record before validation. For example:


# Before
belongs_to :account
before_validation -> { self.account ||= Current.account }

# After
belongs_to :account, default: -> { Current.account }

Notable Changes

  • Virtual/generated column support for MySQL 5.7.5+ and MariaDB 5.2.0+

 


create_table :generated_columns do |t|
  t.string  :name
  t.virtual :upper_name,  type: :string,  as: "UPPER(name)"
  t.virtual :name_length, type: :integer, as: "LENGTH(name)", stored: true
  t.index :name_length  # May be indexed, too!
end
  • Following methods have been removed:

 

#uniq, #uniq!, #unique_value, #insert_sql, #update_sql, and #delete_sql

Notable Changes

  • Virtual/generated column support for MySQL 5.7.5+ and MariaDB 5.2.0+

 


create_table :generated_columns do |t|
  t.string  :name
  t.virtual :upper_name,  type: :string,  as: "UPPER(name)"
  t.virtual :name_length, type: :integer, as: "LENGTH(name)", stored: true
  t.index :name_length  # May be indexed, too!
end
  • Following methods have been removed:

 

#uniq, #uniq!, #unique_value, #insert_sql, #update_sql, and #delete_sql

Made with Slides.com