cookhappy
cookhappy
Code!
7 posts
Don't wanna be here? Send us removal request.
cookhappy · 11 years ago
Text
Adding and pushing to git
git add .  (adds all files to commit)
git commit -m "useful message describing what you did"
git push origin master
Or use 
git commit -a -m 'added new benchmarks'
to add and commit all files, with the message
0 notes
cookhappy · 11 years ago
Text
Creating links in Rails
Instead of <a> tags use:
<%= link_to "Text_for_link", "URL" %>
Example of internal link:
<%= link_to "Home", "/" %>  this is to root page <%= link_to "About", "/about" %>
Example of external link:
<%= link_to "Facebook", "http://facebook.com" %>
0 notes
cookhappy · 11 years ago
Text
Change route to different name/style
In routes.rb, change 
get 'controller/action'
get 'pages/about'
to
get "url_ending_you_want" => 'pages#about'
for example:
get "about" => 'pages#about'
0 notes
cookhappy · 11 years ago
Text
Change the root of your site
In routes.rb use:
root to: 'controller#action_name' 
root to: 'controller#page'
for example:
root to: 'pages#home'
0 notes
cookhappy · 11 years ago
Text
Create pages with a pages controller
You can use:
rails generate controller [Name] [action action, etc] 
For example:
rails generate controller Pages about home 
0 notes
cookhappy · 11 years ago
Text
Upgrading Ruby with rvm
Use 
rvm install [version you want]
for example:
rvm install 2.1.1
0 notes
cookhappy · 11 years ago
Text
How to start a new Rails project
Use 
rails new project_name
You don't need to make a new directory/folder beforehand because this command will create one with the same name as your project. But if you do have a folder already that you want to use, then just make your project the same name and rails will recognize it exists already.
Btw, you can make a new directory/folder with
mkdir directory_name
Or if you need to specify a place within other folders:
mkdir folder/directory_name
0 notes