The calendar is gone.
Click here to view posts


How to
Hello,
This is my first attempt at a real website. I have been using RoR in an enterprise setting and I came up with some good idea for my site. I am not a graphic artist or a web font end guru. Most the interesting things I create will not be visible to the viewers of the site. I will have a different CSS style based on the time of the day. I have created an image BECKER.{ruby method}. This should also be different depending on the hour of the day + a day offset.

I have used Ajax calls. The menu at the top "Blogs Articles Around About Contact" are all Ajax calls. There was no reason to make the main an ajax call. The < date navigation of the article titles are also an Ajax call. These calls have nothing special about them. I did omit the :update part of the hash and return inline RJS. I had to do this because I am updating a number of divs that do not share a common parent. I am sure I will add many more before I am done.

I have used routes to make nice pretty simple urls. For example to link to this post directly you can use

  • http://stephenbeckeriv.com/How_to
  • http://stephenbeckeriv.com/article/How_to
  • http://stephenbeckeriv.com/search/articles/ajax_call
  • http://stephenbeckeriv.com/tag/routes
  • http://stephenbeckeriv.com/tag/ajax


You can not say that I do not give you options.

So I use routes to allow different data to be loaded. You can go to /title_name or /title%20name. I did not like the url encoding look so I sub out _ for spaces. I try not to use ! or ? in my titles.

You can view just the post listed with the context of blog article or other, /context/title_or_no_title_is_fine . Blogs will be short snippets, articles will be longer post, and other anything else.

You can also search by my tags, which are displayed below a post. /tags/tag_name Tags will only be one word url safe.

You can search, but currently its not a full text search do to database implementation issues. /search/text_to_search . You can also add in the context listed above to this /search/context/text_to_search .

Last I have date. Lets say you remember i posted something around June 10th /date/year4digits_month2digts_day2digts . So /date/2006_06_10 and it will return the 15 results with a time stamp less then that date. You might want to add a day because the database uses the time in the stamp as well.

Below is an example of the routes code I use
ActionController::Routing::Routes.draw do |map|
  # The priority is based upon order of creation: first created -> highest priority.
  
  
  map.connect 'article/:id',:controller=>"main",:action=>"index",:search=>"article"
  map.connect 'search/:id',:controller=>"main",:action=>"index",:search=>"all"
    map.connect 'search/articles/:id',:controller=>"main",:action=>"index",:search=>"article"
  map.connect 'tags/index/:id',:controller=>"main",:action=>"index",:search=>"tag"
  map.connect 'tag/index/:id',:controller=>"main",:action=>"index",:search=>"tag"
#dups till i can make it create urls with out index in it
  map.connect 'tags/:id',:controller=>"main",:action=>"index",:search=>"tag"
  map.connect 'tag/:id',:controller=>"main",:action=>"index",:search=>"tag"

  map.connect ':controller/:action/:id'

end