Très bien pour les pages marketting où les textes à traduire varient beaucoup trop et où l'utilisation des variables n'est donc pas pratique.
C'est aussi bien pour les mails !
-
http://guides.rubyonrails.org/action_view_overview.html#localized-viewsEnfin trouvé la solution à mon probleme d'encoding :
incompatible character encodings utf-8 and ascii-8bit
Tout ça a cause d'un bug de la gem mysql qui pense que certaines chaines récupérées en base sont encodée en ascii-8bit alors que pas du tout.. La solution est simple : utiliser la gem mysql2 à la place qui résout ce probleme. Ce genre de bug rend fou car on a beau chercher une logique, il n'y en a pas, bref merci Google :-)
-
https://links.infomee.fr/?Hl5uogPour modifier les header Cache-control pour pouvoir cacher les pages public quand user non auth
expires_in 3.minutes, :public => true
-
https://devcenter.heroku.com/articles/http-caching-ruby-railsFramework counterpart.
In config/initializers, you will find a file called inflections.rb. There are some instructions in here, but you will want something along the lines of:
ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'bonus', 'bonuses'
end
-
http://stackoverflow.com/questions/3517989/ruby-on-rails-how-do-you-explicitly-define-plural-names-and-singular-names-in-rThe need for X-Accel-Redirect (and it’s sibling X-Sendfile) comes from two distinct requirements
The need to deliver large files.
The need for those files to not be available to the public.
-
http://thedataasylum.com/articles/how-rails-nginx-x-accel-redirect-work-together.htmlL'appel d'une fonction peut se faire avec ou sans parenthèse :
foo() ou foo
Ensuite, un Hash peut avoir plusieurs formes..
{'a' => 12}
où 'a' peut être n'importe quoi : string (comme ici), mais aussi objet,
symbol : exemple :
{:a => 12}
La nouvelle syntaxe, valable uniquement si les clés sont des symboles :
{a: 12, b: 'toto'}
Et enfin quand on call une méthode qui peut prendre un hash en argument (entre autre), pas besoin de mettre les { }
foo({a: 12, b:14})
ou
foo(a: 12, b:14)
ou
foo a: 12, b:14
-
http://stackoverflow.com/questions/16576477/how-do-functions-use-hash-arguments-in-rubySympa ce workflow de protection de login
-
https://hakiri.io/blog/rails-login-securityNe pas nommer une méthode de controller rails "requete"
:D
-
https://links.infomee.fr/?xP7CzACustom configuration in Rails 4.2 with x namespace
-
http://www.richardhsu.me/posts/2015/04/02/rails-4-custom-configurations.html