Copyrighted Material
Total Page:16
File Type:pdf, Size:1020Kb
25_081204 bindex.qxp 11/30/06 11:15 PM Page 315 Index :adapter value, 186 • Symbols • Add Interpreter dialog box, 34 && (and) operator, 96 add_comment method, 241 = (assignment) operator, 96 add_keyword method, 253 @ (at sign), instance variables, 114 add_some_keywords form, 254–255 backslash (\), referring to branches, 80 agile activity, 13 ~ ( bit inversion) operator, 91 agile development, 12, 294 [] (brackets), 102, 285 Agile Manifesto, 12 == (comparison) operator, 96 agilealliance.com Web site, 282 { } (curly braces), 122, 285 agilemanifesto.org Web site, 282 <div>. .</div> element, 262 Ajax (Asynchronous JavaScript and XML) ** (exponentiation) operator, 91 introduction, 258 % (modulo) operator, 91 Rails pages, 258–262 ! (not) operator, 96 XMLHttpRequest object, 258 || (or) operator, 96 album2_development, 220 + (overloaded) operator, 92 alignment, using tables for, 142–143 # (pound sign), 90, 197 anchor element, start and end tags ? (question mark), 146 (HTML), 136, 209, 210 “ “ (quotation marks), 94 and (&&) operator, 96 << (shifting) operator, 91 applications, 50 >> (shifting) operator, 91 area, workbench, 67 <%= %> tag, ERb, 168 Array class, 123 <=> (three-way comparison) operator, 91 arrays hotel guest tracking code, 100 indices, 101 • A • introduction, 100 \a escape sequence, 94 loops, 101 absolute names, files, 141 size, 101 Access databases, 36COPYRIGHTEDvalues, MATERIAL 101 ActionMailer: assigning values, 94–95 :Base.server_settings, 265 assignment (=) operator, 96 ActionView: :Helpers module, 201 Asynchronous JavaScript and XML Active Record, 184–185, 295 (Ajax) ActiveRecord: :Base class, 184 introduction, 258 activerecord gem, 185 Rails pages, 258–262 ActiveRecord module, 184–185 XMLHttpRequest object, 258 25_081204 bindex.qxp 11/30/06 11:15 PM Page 316 316 Ruby on Rails For Dummies at sign (@), instance variables, 114 class methods, 187 automatic rendering, 166 classes ActiveRecord: :Base, 184 Array, 123 • B • databases, 116 backslash (\), referring to branches, 80 defining, 114 Beginning Programming with Java For defining, code, 113 Dummies (Burd), 4 instances, 114 belongs_to method, 237 Integer, 121 bit inversion (~) operator, 91 introduction, 113 blocks mailer, 266 curly braces ({}), 122 open, 123, 285–286 overview, 287–288 Photo, 179 blog subclasses, 124–126 comments, 237–242 TimeServiceController, 272 introduction, 233 client computer, 129 keywords, 243–255 close button, 69 visitor input validation, 235–237 collections, iterators, 118 @body assignments, e-mail, 267 collection_select method, 252, 253 borders, invisible, 142 columns brackets ([]), 102, 285 creating, 60 built-in unit testing, 290–291 databases, creating, 180 Burd, Barry (Beginning Programming with date_created, 188 Java For Dummies), 4 headings, displaying, 187–188 id columns, 198–200 names, 60 • C • types, 60 calling, methods, 118 columns method, 187 case-sensitivity, 93, 138 commands, puts, 164 catalogs Comment model, dreaming project, 239 introduction, 48 comments mysql, 47 add_comment method, 241 test, 47 dream blog, 237–242 check boxes HTML, 139 code example, 151 introduction, 90 HTML forms, 151 comparison (==) operator, 96 keywords, 254–255 compiled languages, 15–16 check_box method, 254 concatenation, 92 checkout method, 148 configuration chevron, 70 convention over, 18, 161–162, 294 chomp method, 196 RadRails, 33–36 class keyword, 97 25_081204 bindex.qxp 11/30/06 11:15 PM Page 317 Index 317 configuration files, 17 databases. See also legacy databases configure-service mode, 43 Access, 36 connect method, 311 columns, creating, 180 connections, databases connecting to, 185–187 connecting to, 185–187 connection, troubleshooting, 41–45 troubleshooting, 41–45 creating, 47–50 console, sending text to, 163–165 fields, 38 Console view introduction, 12 introduction, 57 modifying, 188–191 puts command, 164 rows, adding, 194–195 running application, 81 rows, deleting, 193 Container field, 77 rows, displaying, 183 containers, 77 rows, finding, 195–197 controllers servers, 38 creating, 157–159 servers, troubleshooting, 42–43 names, overriding legacy, 303 tables, classes, 116 overview, 156–157 tables, creating, 58–61, 179 values, passing to views, 167–173 tables, creating (code example), 180 views, 167–173 tables defined, 38 convention over configuration, 18, tables, enhancing code, 228 161–162, 294 tables, names, overriding legacy, counting coins program, 93 301–303 covert tricks, 170 tables, objects and, 116 create method, 195, 230 traveling, 42 Create New Schema dialog box, 49 version numbers, 190–191 Create Shortcut wizard, 30 date_created column, 188 create_setup method, 266 DB2, 36 CRUD (Create, Read, Update, Destroy) db:migrate task, 180 operations decide_about method, 111 databases, 66 declarations, HTML, 139 inherited methods, 179 def_show, 161 overview, 296 delete method, 123, 148 .csv files, 36 delete_all method, 193 curly braces ({}), 122, 285 deployment, 130 desktop, shortcuts, RadRails, 30 destroy_all method, 193 • D • dialog boxes data, displaying, 187–188 Add Interpreter, 34 Data perspective, 72 Create New Schema, 49 :database value, 186 New File, 182 New Project, 51 25_081204 bindex.qxp 11/30/06 11:15 PM Page 318 318 Ruby on Rails For Dummies dialog boxes (continued) else keyword, 97 New Rails Project, 52 elseif keyword, 97 Preferences, 83–84 e-mail Select a Wizard, 76 @body assignments, 267 Select Perspective, 72 cordial but forceful message, 267 Show View, 74 enabled Web site, 264 Windows Security Alert, 54 mail servers, 263 Workspace Launcher, 32 mailer class, code, 266 DIRT operations, 66 mailer configuration, 264–265 Disable Table Pluralization option, Mailer configuration code, 264 305–306 mailing messages, 265–269 display_cart, 165 mailing messages, code example, 265 displaying messages, 264 data, 187–188 messages, code example, 264 images, 140–141 empty tags (HTML), 137–138 values, 94 end keyword, 97 <div>. .</div> element, 262 end tags (HTML), 136–137 do keyword, 97 enhancing code DOCTYPE declaration (HTML), 139 database table, 228 Don’t Repeat Yourself (DRY), 18, 19, file input field, 228–230 162–163, 293 images, 230 Download link, interpreter, 22 entities (HTML), 138–139 downloads, MySQL Administrator, 40 environment, server, 312–314 Dream model, 234, 247 environment.rb file, 265 dreaming_development database, 234 ERb tags, 205–206 dreams_keywords table, 246 escape sequence, 94 drop-down lists establish_connection method, 185 keywords, 252 exponentiation (**) operator, 91 populating, 180 expressions DRY (Don’t Repeat Yourself), 18, 19, interpolated, 92 162–163, 293 introduction, 91 duck typing, 286 regular expressions, 243 dynamic typing, 14–15 ternary, 99 extensions, filenames, 29 • E • each iterator, 192 • F • each method, 118–120 false keyword, 97 each_plus_interest method, 123 fields editing, files, 80–81 databases, 38 editor, workbench, 68 hidden (HTML), 152 elements (HTML), 137 filenames, extensions, 29 25_081204 bindex.qxp 11/30/06 11:15 PM Page 319 Index 319 files gif files, 140 absolute names, 141 Google search engine, 145 class files, 81 configuration files, 17 editing, 80–81 • H • importing easy way, 214–215 habtm (has_and_belongs_to_many) importing geeky way, 216–218 relationship, 244 importing, Import Wizard, 216–218 hashes relative names, 140 [] (brackets), 102, 285 renaming, 159–161 {} (curly braces), 285 fill method, 123 code example, 102 find method, 187, 195 entries, 102 find_by_sql method, 198 format string, 103 Firebird, 36 loops, 103 flow of photo album application, 226–227 passing to methods, 108–109 folders, workspace, 32 has_many :comments, 241 for loop, 99 hidden fields (HTML), 152 form elements (HTML) host computer, 130 check boxes, 151 :host value, 186 fields, hidden, 152 hostingrails.com Web site, 282 text areas, 147–149 href attribute, start tags (HTML), 136 forms HTML (hypertext markup language) add_some_keywords, 254–255 anchor elements, 209 HTML, 144–146 check boxes, 151 parameters, 172–173 comments, 139 frameworks, 13 declarations, 139 DOCTYPE declaration, 139 elements, 137 • G • empty tags, 136–137 gem end tags, 136–137 installer, 27 entities, 138–139 session, 27 fields, hidden, 152 gems, activerecord, 185 form elements, 147–152 Generators view forms, 144–146 creating projects, 78–79 forms, text field code example, 144 model creation, 57 image elements, 140–141, 231–232 options, 56 introduction, 134–136 scaffolds, 61 link_to method, 209 get method, 148 option selectors, 149–150 get_picture method, 221, 232 paired tags, 137–138 gets method, 96–97, 196 permissiveness, 138 get_time method, 271, 273 25_081204 bindex.qxp 11/30/06 11:15 PM Page 320 320 Ruby on Rails For Dummies HTML (hypertext markup language) importing files (continued) easy way, 214–215 simple code example, 132 Import wizard, 216–218 start tags, 136 inheritance table, code example, 142 CRUD operations, 179 table header elements, 143 Photo class, 179 tables, 142–143 subclasses, 124 tag example code, 134–135 initialize method, 115 text area creation code example, 147 input text field, 146 keyboard, 96–97 Web pages, 132–133 validating, 235–237 HTML-safe method, 209 validating, code example, 235 HTTP (hypertext transfer protocol) insert method, 123 description, 131 installation methods, 148–149 components, 23 transactions, 131 gem, 27 hypertext markup language. See HTML interpreter, 22–26 irb, 25 Java, 27–28 • I • MySQL, 36–39 id numbers, 198–200 MySQL Administrator, 40–45 IDE (integrated development RadRails, 28–36 environment), 27 RadRails, troubleshooting, 33 idempotence, 148–149 Rails, 26–27 if keyword, 97 set path,