This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a new rails app called DinnerTyme | |
Create a model, view, controller for the following types and also create their associations. | |
10 points | |
-- Recipe -- | |
name - the name of the recipe | |
directions - this are the directions for the recipe | |
photo | |
rating - a number between 1 and 5 | |
serves - the number of people it serves |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file should contain all the record creation needed to seed the database with its default values. | |
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). | |
# | |
# Examples: | |
# | |
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) | |
# Mayor.create(name: 'Emanuel', city: cities.first) | |
g1 = Grocery.create(:name => "milk", :quantity => 3) | |
g2 = Grocery.create(:name => "eggs", :quantity => 12) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# checking the path | |
rails c | |
pp Rails.application.config.assets.paths | |
# in config/application.rb | |
config.assets.paths << "#{Rails.root}/vendor/assets/bootstrap" | |
<%= f.button({:class => "btn btn-primary"}) %> | |
<%= render :partial => 'shared/showsong', :locals => {:song => @song} %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
***database tasks | |
add_column | |
add_index | |
change_column | |
change_table | |
create_table | |
drop_table | |
remove_column | |
remove_index | |
rename_column |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add twitter bootstrap | |
change application.html.erb | |
add new menu | |
home page | |
change error messages - use partial with twitter bootstrap | |
refactor groceries page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Final Project: | |
05 pts: Create new rails app called DinnerTyme | |
15 pts: Create the model, view and controllers using this screenshot as a reference: | |
http://grab.by/h9sC | |
10 pts: Create a home page (index) using a Home controller | |
10 pts: Create a navigation system (links) at the top of the site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "GIMMIE A NUMBER!" | |
response = gets.to_i | |
# asks the user for a number and stores the input into variable response | |
begin | |
response.explode | |
# explodes the program and causes an error | |
rescue | |
puts "The square of #{response} is #{response**2}." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//= require jquery | |
//= require jquery_ujs | |
//= require_tree . | |
$(function(){ | |
$('#add_answer').click(add_answer); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_for @question do |f| %> | |
<div class='field'> | |
<%= label_tag :question %> | |
<%= f.text_field :question_text %> | |
</div> | |
<div class='field'> | |
<input type="button" id="add_answer" value="Add Answer" /> | |
</div> | |
<div id='answers'></div> | |
<div class='field'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//= require jquery | |
//= require jquery_ujs | |
//= require_tree . | |
$(function(){ | |
$('#add_answer').click(add_answer); | |
}); |