My current timezone : GMT+2 ('Europe/Paris')
rails new sandbox
(rails 4.1.1)
rails g model User name:string
Database : Postgresql 9.3.4
In seed.rb
:
User.create(name: 'Kévin')
DuplicateClassName
: Reports errors if the same class or interface name is used in multiple files
EmptyStatementSniff
: Reports errors if the a statement is empty (only whitespaces or comments)
ForLoopShouldBeWhileLoopSniff
: This rule is based on the PMD rule catalog. Detects for-loops that can be simplified as a while-loop.
ForLoopWithTestFunctionCallSniff
: This rule is based on the PMD rule catalog. Detects for-loops that use a function call in the test expression.
Heroku is a incredible tool for deploying web apps in minutes. The problem comes when you want to deploy an with a private gem.
vendor/your_gem
and link it in Gemfile
:gem 'your_gem', path: 'vendor/your_gem
Lets look at the simplest scenario | |
provide.value('a', 123); | |
function Controller(a) { | |
expect(a).toEqual(123); | |
} | |
in this case the injector simple returns the value as is. But what if you want to compute the value. Then use a factory |
What's assets ? Assets are all javascripts, css, and images files. They are stored in app/assets
and app/javascripts
.
The directory app/assets
is handled by a tool called sprockets
that we want to change in future.
The directory app/javascripts
is handled by another tool called webpack
.
Why we have 2 directories with differents tools ?
Historically, we used only the directory app/assets
for all javascripts, css and images files. Sprockets was used to apply some transformation on all those files.
Using multiple namespaces will require to have also namespaces views.
For exemple, if you have an Admin
namespace, with a Admin::ProjectsController
with a show
action that also exists in non namespaced ProjecsController
, you cannot render views/projects/show.html.erv
from Admin::ProjecsController
.
The researched behavior is to try to render the views/admin/projects/show.html.erb
, and, if it doesn't exist, fallback to views/projects/show.html.erb
HTML & CSS font partie des langages du web, c'est à dire qu'ils peuvent être lu et compris par un navigateur web. En terme technique, un navigateur web est un logiciel qui est capable de parser et d'interpréter de l'HTML, du CSS, et d'exécuter du JavaScript (on verra ca plus tard).
Donc, quand on envoie un fichier HTML à a un navigateur (ou quand on ouvre un fichier HTML présent sur son ordi dans un navigateur), si le fichier est bien écrit, qu'il respecte la spécification du W3C (World Wide Web Consortium), alors il va construire une interface graphique a partir du code HTML & CSS.
Du coup, HTML c'est vraiment le contenu, que l'on structure dans des tags (le plus courant est la div, pour "division"). Depuis HTML5, on a a disposition plein de nouveau tags, qui se comportent exactement comme des divs (ils sont par defaut des blocks), mais ils ont une valeur "sémantique", qui va permettre aux moteurs de recherche de mieux comprendre notre page web quand on se fera indexer. Donc c'est mieux d'utiliser les nouv
When writing a rails app, we often have to deal with multiple namespaces. The most common case is having classic actions and some others in an admin namespace. Some actions may have same views between namespaces.
For exemple, you could have a ProjectsController
with an action index
:
class ProjectsController < ApplicationController
def index
# do something
end
end