The document discusses various topics relating to building web applications with Ruby on Rails such as setting up authentication with Devise, working with assets using the asset pipeline, adding AJAX functionality using remote links and JavaScript responses, handling dependent associations to avoid orphan records, and creating custom view helpers like a gravatar image generator. It also briefly mentions deployment and provides code examples for integrating these techniques.
7. Session 6: Stocking Fillers... More on Assets AJAX Orphans! Your very own view helper
8. The Asset Pipeline NEW in Rails 3.1! “ A framework to concatenate and minify or compress JavaScript and CSS assets.” Also, enables CoffeeScript, Sass and ERB for assets. The default behavior in Rails 3.1 and onward is to concatenate all files into one master file each for JS and CSS.
9. Pre-Processing in Assets Asset helpers are available e.g. .class { background-image: url(<%= asset_path 'image.png' %>) }
10. The Asset Pipeline: Locations app/assets – your app's assets vendor/assets – not maintained by you lib/assets - maintained by you but not app specific public/ – old skool static location
11. What assets do we have? Shows assets available to application including stuff in gems. Rails.application.config.assets.paths
12. JS Assets Go to: 127.0.0.1:3000/assets/application.js In assets/application.js: //= require jquery //= require jquery_ujs //= require_tree . This is a sprockets manifest file.
13. CSS Assets Go to: 127.0.0.1:3000/assets/application.css In assets/application.css: // *= require_self // *= require_tree .
15. AJAX: Step 1 Add :remote => true to link_to 'Destroy', station, confirm: 'Are you sure?', :method => :delete
16. AJAX: Step 2 Add id to element in view <tr id = "station_<%= station.id %>"> Respond to javascript in controller respond_to do |format| format.html { redirect_to stations_url } format.js end
17. AJAX: Step 3 Keep id of the station to be removed. @remove_id = @station.id Define your response javascript: destroy.js.erb $('#station_<%= @remove_id %>').fadeOut();