How to implement dependent dropdowns in Rails 4 with an unobtrusive jQuery script

Logo devnterface d88f51727b3053dd3115e1ef9c566ad79b4c2edb3cd208c06345fc37058bebd9

I recently had to implement a view with the classic search form with two select dependent on each other. My aim was to leave the page as clean as possible and make the code that loads the options for the daughter dropdown reusable.Suppose, therefore, to have two models, SpecializationType and Specialization, defined as follows:1234567891011121314151617181920212223242526272829303132class SpecializationType < ActiveRecord::Base # F...

Read more

Rails Best Practices 6: Filters and helpers file

Logo devnterface d88f51727b3053dd3115e1ef9c566ad79b4c2edb3cd208c06345fc37058bebd9

With the today’s post I shall conclude my series on Ruby On Rails Best Practices . This is not because the required topics are completed, but rather because after the release of Rails 3.0, some constructs have been changed and should be reviewed. Probably in future we will return to talk about best practices, but starting from the new features introduced in the current Rails version. But now I will descr...

Read more

Rails Best Practices 5: Optimize Migration

Logo devnterface d88f51727b3053dd3115e1ef9c566ad79b4c2edb3cd208c06345fc37058bebd9

Migrations, in my opinion, are one of the best things in Rails since these allow the creation and populating the database using ruby code without having to worry about which type of db run below. That said, even writing the migration is better to follow some best practices. 1. DB Index The first practice I strongly recommend is to define indices for the external keys and for all those columns on which you will make sor...

Read more

The top 20 plugins to create a Rails application

Logo devnterface d88f51727b3053dd3115e1ef9c566ad79b4c2edb3cd208c06345fc37058bebd9

Rails is now closer to its official third release and all plugins and gems authors are working to ensure compatibility of their products with the new version of the framework.Among the many Rails plugins released by the community, I make a list of 20 most used (and useful) in our projects at DevInterface.Authentication Authlogic: this plugin is def...

Read more

Rails Authlogic + Subdomain_fu Template

Logo devnterface d88f51727b3053dd3115e1ef9c566ad79b4c2edb3cd208c06345fc37058bebd9

The second free Rails startup skeleton written by DevInterface and releases under Rails MIT license is Rails Authlogic + Subdomain_fu Template.Rails Authlogic + Subdomain_fu TemplateThis template works as a skeleton for any new Rails application (using Rails 2.3) that aims to provide authentication with subdomain support.To install and run this template perform following actions:12345git clone git://github.com/devinterface/authlogic_subdomain_fu_startup_app.git cp config/database.ym...

Read more