Last updated: 03/08/2013 02:37:56 PM
Some Ruby 2.0 classes have a to_h method. to_h converts the object to a Hash. At the time of this writing, the following classes have the to_h method:Here is the contents of test.rb...
Last updated: 03/08/2013 06:57:01 AM
Ruby 2.0.0 has been released!! Follow the release link here: http://www.ruby-lang.org/en/news/2013/02/24/ruby-2-0-0-p0-is-released/I run Linux exclusively and my favorite distro is Ubuntu. The following is an install script I used to install Ruby 2.0.0 on my Ubuntu distro. You may need to tweak it a little to meet your needs, however, the actual script is in the support files....
Last updated: 03/08/2013 06:23:37 AM
Ruby 2.0 supports a feature to make the creation of an Array of Symbols convenient.Below are a few variations producing the same results.Download the support file and run the example....
Last updated: 03/08/2013 03:07:03 AM
I was very excited when I noticed that Ruby 2.0.0 had been released. I jumped through all of the hoops to install Ruby 2.0.0 and ran into a small snag while testing everything on my staging server. While trying to install Passenger on my staging server the following error occurred:After digging around a little bit I figured out something that would work:passenger-4.0.0.rc4.gem is the file that was produced at the time of this writing. You...
Last updated: 03/07/2013 07:04:45 AM
Default values and attributes are set in config/routes.rb.Each time the values are built for a sitemap url or meta tag for a page, the default values are used as a base. The controller in question is "asked" to provide values for defined attributes and those values are merged with the default values overwriting them. Also, if a model object is available the same process is repeated.DuckMap defines default attributes for all values required by sitemap...
Last updated: 03/05/2013 09:43:54 PM
DuckMap supports the following HTML Meta Tags.To include the meta tags in your app, simply add the view helper method: sitemap_meta_tag.The default behavior is to acquire values from the first model found on a controller. The model is interrogated for the following attributes: :canonical, :description, :keywords, :lastmod, and :title. If the attribute exists on the model, then, the value is used. You have the option of mapping attributes to your model.For example, here we are...
Last updated: 02/26/2013 08:40:41 PM
Filters give you the power to control the contents of a sitemap based on verbs, controller name, action name, and route name. The default configuration is to exclude everything except routes that have an action name of :index or :show. For most Rails apps, that should cover the general needs of generating a sitemap.You can apply route filters using two methods: - Using exclude and include statements within a sitemap block. - Using exclude and...
Last updated: 02/23/2013 05:54:26 PM
I think the easiest way to explain sitemaps with nested resources is to explain the process from a high level.When a sitemap is built:Given the following configuration:Would have a named route like:The mechanism used to acquire these values is: sitemap_capture_segments. You can see that the "show" action for the route has segment keys :book_id and :id. When the url is built, the Comment model is "asked" for the segment key values for the route by...
Last updated: 02/22/2013 07:43:32 PM
DuckMap provides support for namespaces and could be a big help for logically grouping sitemaps for large sites. Sitemaps behave in the same manner with or without a namespace. The main difference is the actual path pointing to the sitemap.A few points:Given the following config/routes.rbNotice that we were able to insert a sitemap without using a block and the default name is still sitemap.The demo application shows a few combinations of what is possible....