Steven Petryk
Rails :)
WAMP :(
$ rails generate model task name done:boolean due_at:datetime
1. Create the task model
# Create a task
task = Task.create(name: "Give Rails Tech Talk", due_at: Time.now)
task.name # => "Give Rails Tech Talk"
# Find and update a task
Task.find_by_name("Give Rails Tech Talk").update(done: true)
# Get a Relation of tasks
urgent_tasks = Task.where(done: false).where('due_at < ?', 1.day.from_now)
# Destroy a task
Task.last.destroy
$ rake db:migrate
2. Migrate the database
3. ???? 4. Profit
rails generate controller tasks index new create show edit update destroy
1. Create the TasksController
class TasksController < ApplicationController
def index
end
def new
end
def create
end
def show
end
def edit
end
def update
end
def destroy
end
end
2. Update your routes 3. ??? 4. Profit
We will be learning Rails in depth in SIGWEB.
Sundays from 4:30-6:15.
Student Union 220.