Skip to content

mysen/roc-demo1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

See the accompanying keynote presentation in doc/

First, show running miniblog app
Then:
$ rm -rf miniblog

why!!!
well, cause in about 20 min, i can have it back
 
$ rails new miniblog
$ bundle install
$ rails server
 + look at dir structure, app dir, config dir, public dir
 + edit public/index
$ rails generate scaffold messages body:text
 + look at view, model, migration
$ rake db:migrate
 + create DB
$ rails server
 + show scaffold

now, edit html: 
+ delete extra stuff from index
+ move new form to top of index
+ redirect to index after create
+ delete edit
+ delete new
+ edit show (paste)
+ copy in new css

edit controller:
 
 + delete update, edit, new
 + show .xml .json, remove

Now, add replies
$ rails generate -h
$ rails g model -h
$ rails g model reply body:text message:references
$ rake db:migrate

Edit Model
 + show belongs_to relation in replies.rb
 + add has_many relation in 
 + show console msg.replies.build(:body=>"this is from the command line")

Edit HTML
 + add replies loop to messages/show
 + add form to messages/show

Now, add reply controller
$ rails g controller -h
$ rails g controller replies create 

Edit routes
+ nested resource 

Edit HTML
+ refactor replies into partials 
+ add comment counts on messages/index

If more time...
+ look at order by in active record
+ limit 30


About

miniblog clone for Rails on Campus - Session #1

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published