Unformatted text preview:

Son of the Inventory AppBut firstThree PossibilitiesInstallationMigrate to productionConfigurationVirtual HostOdds and EndsTonight and Next WeekWhen we left our applicationLet's take a look at the sourceNext StepsStatusnew.html.erbedit.html.erbA validationdate_submittedWhat's the difference?date_selectAnother ValidationFirst Try: 1 day ago and ErrThis WorksRefining Date AppearanceUsing strftimestrftime formattingRefining our indexSearchesSimple SearchThe inputThe InputAn if to catch the searchfindfind_by_sql()Refining a findCombining codePowerPoint PresentationOne more thingAdvanced SearchA simple pageordered.html.erbTry to load ita better findmachine.erbsearch.erbOk?search/index.html.erbSlide 47machine controllerA basic working searchA selectionselect_tagSlide 52Our constantSo far so goodChanged to an ArrayController vs ModelCall Method from ControllerBack to our general searchSlide 59SourcesSon of the Inventory AppSon of the Inventory AppBut firstBut firstThe question came up about how to run a production server with Rails…The question came up about how to run a production server with Rails…Three PossibilitiesThree PossibilitiesUse fastcgi and apacheUse apache as a proxy server, against a cluster of mongrel servers (this is covered in Agile Web Development with Rails)And the one you want, passenger:http://www.modrails.com/I'm still playing with this, more to come…Use fastcgi and apacheUse apache as a proxy server, against a cluster of mongrel servers (this is covered in Agile Web Development with Rails)And the one you want, passenger:http://www.modrails.com/I'm still playing with this, more to come…InstallationInstallationIt's a gem so use "sudo gem install passenger"Then run:sudo passenger-install-apache2-moduleThis will install the modules neededIt's a gem so use "sudo gem install passenger"Then run:sudo passenger-install-apache2-moduleThis will install the modules neededMigrate to productionMigrate to productionrake migrate RAILS_ENV=production This will create a new empty database for a production serverYou can copy your development db over the production one if you want to carry your test data over, or dump and load the datarake migrate RAILS_ENV=production This will create a new empty database for a production serverYou can copy your development db over the production one if you want to carry your test data over, or dump and load the dataConfigurationConfigurationIn the apache config file, check to make sure you have the modules loadingI had to add these manually on my laptopIn the apache config file, check to make sure you have the modules loadingI had to add these manually on my laptopLoadModule passenger_module /usr/local/lib/ruby/gems/1.8/LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/ gems/passenger-2.0.3/ext/apache2/mod_passenger.sogems/passenger-2.0.3/ext/apache2/mod_passenger.so# Passenger config# Passenger configPassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3PassengerRuby /usr/local/bin/rubyPassengerRuby /usr/local/bin/rubyVirtual HostVirtual HostYou need to define a virtual hostThis is what I’m using for nowNote that I’m using podzone.net, this is dyndnsThe base uri should point to a soft link to your application's public folder--doesn't work for meYou need to define a virtual hostThis is what I’m using for nowNote that I’m using podzone.net, this is dyndnsThe base uri should point to a soft link to your application's public folder--doesn't work for me<VirtualHost *:80><VirtualHost *:80> ServerAdmin [email protected] [email protected] DocumentRoot /Library/WebServer/DocumentsDocumentRoot /Library/WebServer/Documents RailsBaseURI /inventoryRailsBaseURI /inventory RailsSpawnMethod conservativeRailsSpawnMethod conservative ServerName avatar.podzone.netServerName avatar.podzone.net</VirtualHost></VirtualHost>Odds and EndsOdds and EndsAfter configuring the web server, restart it:sudo apachectl gracefulWatch your logs:tail -f /var/log/httpd/error_logAfter configuring the web server, restart it:sudo apachectl gracefulWatch your logs:tail -f /var/log/httpd/error_logTonight and Next WeekTonight and Next WeekTonighttime and datetagslots searchesNext Weekmore searchesemailfilesystem access?Tonighttime and datetagslots searchesNext Weekmore searchesemailfilesystem access?When we left our applicationWhen we left our applicationA database backendSome MigrationsPlayed with TypesPlayed with Time MethodsSome ValidationsA database backendSome MigrationsPlayed with TypesPlayed with Time MethodsSome ValidationsLet's take a look at the sourceLet's take a look at the sourceModelControllerViewsModelControllerViewsNext StepsNext StepsRefine status optionsRefine date_submittedAdd searchesRefine status optionsRefine date_submittedAdd searchesStatusStatusWe can't depend on the user to type what we wantSo we need to define what statuses we'll acceptordered, delivered, deployedProvide a controlled method for selectionRadio buttonsWe can't depend on the user to type what we wantSo we need to define what statuses we'll acceptordered, delivered, deployedProvide a controlled method for selectionRadio buttonsnew.html.erbnew.html.erbIn the views/machine dir, we need to edit new.html.erb fileThis one's easy, note we're setting a defaultIn the views/machine dir, we need to edit new.html.erb fileThis one's easy, note we're setting a default <p><p> <%= f.label :status %><br /><%= f.label :status %><br /> <%= f.radio_button :status, "ordered", :checked => true %><%= f.radio_button :status, "ordered", :checked => true %> Ordered <br/>Ordered <br/> <%= f.radio_button :status, "delivered" %>Delivered <br/><%= f.radio_button :status, "delivered" %>Delivered <br/> <%= f.radio_button :status, "deployed" %>Deployed <br/><%= f.radio_button :status, "deployed" %>Deployed <br/> </p></p>edit.html.erbedit.html.erbFor the edit view, the same thing without the defaultFor the edit view, the same thing without the default <p><p> <%= f.label :status %><br /><%= f.label :status %><br /> <%= f.radio_button :status, "ordered" %>Ordered <br/><%= f.radio_button :status, "ordered"


View Full Document

UNC-Chapel Hill INLS 672 - Son of the Inventory App

Download Son of the Inventory App
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Son of the Inventory App and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Son of the Inventory App 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?