<body class='xxx.scss'> or <body class='<%= controller.controller_name%>'>
Then, the css classes can be used in index.html.erb.
2. Some rails helper function:
(1) cycle('a', 'b') sets the css class of each row to either 'a' or 'b' and automatically toggles between the two style names on successive lines.
(2) trunctate(string, length:n) is used to display just the first n characters of string.
(3) strip_tags(string) removes the html tags from the string.
(4) link_to('Product', @product) is equal to
link_to('Product', controller:'products', action:'show', id:product)
The link_to generates a hyper link which execute show method in controller which invokes show.html.erb if nothing in the method.
3. Git usage
(1) basic configuration
$ git config --global --add user.name "Alex"
$ git config --global --add user.email alex@gmail.com
$ git config --global --list
These configuration info will be added every check in as the committer info.
(2) add a .gitignore file to specify a file list that you don't want to check in
(3) create a local empty repository in current directory.
$ git init
(4) add all the files under the current directory to local repository.
$ git add .
(5) commit the change to local repository
$ git commit -m "first commit"
If you want to clear the local repository.
(1) rm -rf .git
If you have a github account, you can push your repository to the github
(1) create a repository on github
(2) $ git remote add origin "YOUR HTTPS GITHUB REPOSITORY URL"
(3) $ git push origin master
No comments:
Post a Comment