-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
110 lines (88 loc) · 4.45 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
INSTALL
# install required gems
sudo rake gems:install
rake ttv:full_resert
rake test # run tests
script/server # start the server
TESTING
To test, first set up seed database
rake db:test:load # resets the schema
rake ttv:seed RAILS_ENV=test # loads up our seed data
For this, I had to write custom rake tasks inside lib/db.rake
http://stackoverflow.com/questions/1097845/how-to-prevent-rake-test-to-call-task-dbtestprepare
GEM COMMENTARY
Prawn 0.6.3 is required due to incompatibility with 0.7
http://github.com/sandal/prawn/issues/#issue/79
BUILT-IN TEST USERS
root user: [email protected] pw: password
standard user: [email protected] pw: password
public user: [email protected] pw: password
TODO
- db transaction logging and viewing
- import of multiple district sets at the same time (allows us to get california, and
a separate set for each county)
AJAX
flash messages are automatically passed on as X-JSON headers, use to report errors, etc
INLINE EDITING
Look at doc/InlineEditArchitecture.xls for DOM ids, and general architecture overview
accepts_nested_attributes_for useful pages
Mentions attr_accessible: http://apidock.com/rails/ActiveRecord/NestedAttributes/ClassMethods/accepts_nested_attributes_for
Nested attributes in "new" http://stream.btucker.org/post/93887650/accepts-nested-attributes-for-fields-for
Original patch discussion http://weblog.rubyonrails.org/2009/1/26/nested-model-forms
Ryan's scraps, http://ryandaigle.com/articles/2008/7/19/what-s-new-in-edge-rails-nested-models
TEMPLATES
use flash[notice][error] for notifications. In js, use ttv.notice/ttv.error
added startAjax, stopAjax, spinner in matching colors http://www.ajaxload.info/
Use prefetching for election to speed up database
AUTHENTICATION
Using authlogic gem, instructions at
http://media.railscasts.com/videos/160_authlogic.mov
http://github.com/binarylogic/authlogic_example/tree/master
http://www.binarylogic.com/2008/11/16/tutorial-reset-passwords-with-authlogic/
EMAIL
Sending mail with gmail requires ruby >=1.8.7, does not work on Leopard default
DATA MODELING
- I was unable to use autogenerated ids for yaml, too much data
Started tracking sessions inside database.
FORMS
The best documentation is PragProg Mastering Rails Forms video
Problem: error messages, default schema is not flexible, ugly layouts
Solution: roll your own error solution that displays off the error object
ApplicationHelper::render_error_messages is a error_messages_for replacemet
The html is defined in:
single field: config/initializers/change_field_error.rb ActionView::Base.field_error_proc override
error summary _error_messages.html.erb: used by the helper to display the error.
STYLE and THEMES
Using Web App Theme for a simple set of style sheets to make the pages look a little
bit nice. No big deal yet just some color etc. Look at these links:
http://github.com/pilu/web-app-theme
http://pilu.github.com/web-app-theme
http://gravityblast.com/2009/07/30/2-minutes-admin-layout-with-rails-and-the-web-app-theme-generator/
IMAGE STORAGE and UPLOADING
Using paperclip installed to filesystem with command:
script/plugin install git://github.com/thoughtbot/paperclip.git
http://github.com/thoughtbot/paperclip
ROUTING
Extending REST model, priceless: http://railscasts.com/episodes/35-custom-rest-actions
Routing: http://guides.rubyonrails.org/routing.html
DEBUGGING
script/console:
- execute url_for like this: app.url_for
# checking routing methods and what they do:
>> r = ActionController::Routing::Routes
>> default_url_options[:host] = "a.com"
>> include ActionController::UrlWriter
>> elections_url(1)
=> "http://a.com/elections.1"
OTHER CODE THAT MIGHT BE USEFUL
auto_resize_options[:onKeyPress] = "if (this.scrollHeight > this.clientHeight && !window.opera)\nthis.rows += 1;"
http://hobocentral.net/about/ Interesting framework, provides fine-grained permissions, authentication, logging
mislav-will-paginate is a recommended pagination gem
Drop-down menu for prototype
http://www.hongkiat.com/blog/drop-down-menu-30-free-scripts-to-enhance-header-navigation/
http://corelib.rubyonrails.org/
http://littlegreenfootballs.com/article/30490_Tech_Note-_Flippy_Triangle_Style
http://www.oscaralexander.com/tutorials/how-to-make-sexy-buttons-with-css.html
/activesupport/lib/activesupport/coreext/hash/conversions Hash::to_xml
Options for generating seed data: http://derekdevries.com/2009/04/13/rails-seed-data/
Doing i10n in database schemas: http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/i18n/i18n5.html