Official introduction and general reference to learning and using Rails.
Link: guides.rubyonrails.org
, which are traditionally used for separating “languages” and “regional setting” or “dialects”. Many international applications use only the “language” element of a locale such as :cs , :th or :es (for Czech, Thai and Spanish). However, there are also regional differences within diffe...
to apply templates to an existing Rails application. The location of the template needs to be passed in to an environment variable named LOCATION . Again, this can either be path to a file or a
In general editing existing migrations is not a good idea: you will be creating extra work for yourself and your co-workers and cause major headaches if the existing version of the migration has already been run on production machines. Instead, you should write a new migration that pe...
use ActionDispatch::Static use Rack::Lock use ActiveSupport::Cache::Strategy::LocalCache use Rack::Runtime use Rails::Rack::Logger use ActionDispatch::ShowExceptions use ActionDispatch::DebugExceptions use ActionDispatch::RemoteIp use Rack::Sendfile use ActionDispatch::Callbacks use A...
Not all caches will reliably cache content where the filename only differs by query parameters . Steve Souders recommends , “…avoiding a querystring for cacheable resources”. He found that in this case 5-20% of requests will not be cached. Query strings in particular do not work at al...
In addition to resource routing, Rails has powerful support for routing arbitrary URLs to actions. Here, you don’t get groups of routes automatically generated by resourceful routing. Instead, you set up each route within your application separately.
But this approach becomes increasingly impractical as the table size increases, since User.all.each instructs Active Record to fetch the entire table in a single pass, build a model object per row, and then keep the entire array of model objects in memory. Indeed, if we have a large n...
is a connection between two Active Record models. Associations are implemented using macro-style calls, so that you can declaratively add features to your models. For example, by declaring that one model belongs_to another, you instruct Rails to maintain Primary Key–Foreign Key inform...