rails assigns attr_accessors
1 2 3 4 5
ORM ~> Object Relational Mapping
- A ruby class is to a databse table as instances of that class are to a row in that table
- the form field should map to the column name
- activerecord’s exists to accomplish CRUD
- active record pattern proposed by Martin Fowler
1 2 3 4 5 6
1 2 3 4 5
Identification of a resource Individual resources that are identified in the requests, for example using the URIs sin web-based REST systems.
REST- the url address should mirror the http verb and url action
- What do you mean by a representation?
- these objects have different representations depending on their name
- .xml should return the xml and .json and return the json
- the objects should be devoid of your form until you ask for them
1 2 3 4
- the routes file are evaluated with lazy evaluation. Which allows you to put the most specific patterns on top and let them trickle down…
- 7 restful routes: get, create, update, delete, show, etc.
url endpoint- the very last thing that is executed after a url request- the last application run is the action in the controller
URL request cascade through a rails app:
- web server gets request
- send it through the rack
- last stop, routes file
- match a route
- request = SongContoller.new
- response = request.index
Rails was the first to have implicit rendering…
1 2 3 4 5 6
class variable can inherit down the inheritance tree a class instance var is private to the class
1 2 3 4 5
VPS- Virtual Private server
Linux distribution - ubuntu server - nginx unicorn DB- postgres
- how does a partition actually work?
- 2 cores or 4 cores?? i don’t know what a core is.
- hardware usually out-paces software
- we have had multi-core processors before we had software to take advantage of it.
- slice, a box, a vps, are pretty much synonymous
dediserve is the server we are using
- RAM has fast access.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
- handles your release management throw the entire code base on your server every time you deploy. Copy code off of Github or server and apply it. This will maintain revisions, roll back easily, compile the CSS in your assets. It can’t happen manually.
will do this for you. It’s script-able and automatic.
- This is run locally.
- cap is what you use to interact with capistrano from the outside (like rails new from outside a rails project)
- capify is how you interact with the gem (like rails generate inside the project folder)
- apache was the market leader for best of breed of web server
ngenx - can handle lots of requests and tries to stay really small
- has much smaller memory footprint
- has some features that are better suited for rails
- ngenx is also a really good load balancer
- config file is much easier to understand than ngenx
Four functions in the config/deploy.rb DSL
- set: capistrano variables
- log rotations - when your log gets too big, it is going to zip it up and send it to some long term storage. The first thing hackers will do is go through the logs.
Reading in prep:
- Capistrano reads its instructions from a capfile.
- many server clusters are hidden behind NATs (Network address translation) and firewalls, to prevent direct access.
- NATs - the process of modifying IP address information in IP packet headers while in transit across a traffic routing device.
- Tasks are the foundation of a Capistrano setup; collections of tasks are typically called Recipes.
Daemons are special system applications which typically execute continuously in the background and await requests for the functions they provide from other applications.
From lowest to highest, the layers of the internet protocol suite are:
- The link layer (commonly Ethernet) contains communication technologies for a local network.
- The internet layer (IP) connects local networks, thus establishing internetworking.
- The transport layer (TCP) handles host-to-host communication.
The application layer (for example HTTP) contains all protocols for specific data communications services on a process-to-process level (for example how a web browser communicates with a web server).
Stateless firewalls require less memory, and can be faster for simple filters that require less time to filter than to look up a session.
Modern firewalls can filter traffic based on many packet attributes like source IP address, source port, destination IP address or port, destination service like WWW or FTP.