My final project is a Ruby on Rails install on my Dreamhost account with a setup similar to my masters project. It is here: http://staceylunden.com/rails/rortrial/public/.
In learning new things, I eventually scrapped my original creation and have re-created the site from scratch. To make the re-creation easier, I planned out the steps I would take. Those notes are included here.
The functionality I wanted to work on is dynamic page creation of About and Search (search is not an actual search at all, it is a dummy page, as a search box is the one thing I decided not to include), the maintenance of two tables that are called dynamically: stories and users, and limiting certain functions to registered users.
First: At command line:
- script/generate scaffold page name:string title:string body:text
- script/generate controller viewer show list
- script/generate scaffold story title:string author:string book:text bibliography:text region:string country:text character1:string emotions1:text character2:string emotions2:text character3:string emotions3:text audience_emotion1:string audience_emotion2:string audience_emotion3:string runtime:string scenes:text synopsis:text flavor:text performance_risks:text grade_range:string title2:string author2:string book2:text bibliography2:text title3:string author3:string book3:text bibliography3:text title4:string author4:string book4:text bibliography4:text comparison:text video:text developmental_characteristic1:text how_addressed1:text developmental_characteristic2:text how_addressed2:text developmental_characteristic3:text how_addressed3:text approved:text
- script/plugin install http://svn.techno-weenie.net/projects/plugins/restful_authentication/
- script/generate authenticated user sessions
- modify db users and stories
- modify app:models: users.rb
- rake
- script/generate migration AddDefaultUser
- model: adddefaultuser.rb:
- self.up
- if !User.find_by_login('admin')
- User.create(:login => 'admin', :email => 'admin@sample.com', :password => '*****', :password_confirmation => '*****')
- end
- end
- rake
- viewer controller.rb: show: @page = Page.find_by_name(params[:name])
- viewer controller.rb: list: @story = Story.find(:all)
- show.html.erb: < %= @page.body % >
- list.html.erb:
- < % for story in @stories % >
- <p><b>Title</b><br />
- < % = h story.title % ></p>
- <p><b>Synopsis</b><br />
- < % = h story.synopsis % ></p>
- < % end % >
- check/modify all views
- create user list, show, delete, edit
- check/modify all controllers
- route.rb:
- map.view_page ':name', :controller => 'viewer', :action => 'show'
- map.list_story ':title', :controller => 'viewer', :action => 'list'
- map.root :controller => 'viewer', :action => 'show', :name => 'about'
- map.logout '/logout', :controller => 'sessions', :action => 'destroy'
- map.login '/login', :controller => 'sessions', :action => 'new'
- controllers: application.rb: include AuthenticatedSystem
- change links
- login/logout button:
- < % if logged_in? % >
- < % = link_to "Log Out", logout_path % >
- < % else % >
- < %= link_to "Log In", login_path % >
- < % end % >
- add login_required to actions
- change checkbox words in 4 views
- all 4 stories put links in p tags
- all 4 stories make approved a checkbox
- route login to form
- route users create to login
- stories index put in p tags
- all 4 stories views h3 in p tags? or css
- pages: new, create, edit, index, show, delete
- stories: new, create, edit, index, show
- users: new, create
- login, logout, session new, session create, session destroy
- viewer show
- users: edit, list, show, destroy
- viewer list
- define admin_required
- edit actions to specify login vs admin
- finish validation in models