Very Basic Git Workflow
Very, very basic git workflow
git pull
git branch dev_branch
git checkout dev_branch
#make some changes
git checkout master
git merge dev_branch
git branch -d branch_to_delete
git push
Written by Sean Behan on 06/17/2012
Testing current_user and Sessions with Sinatra and Rack Test
Assume you have your standard Sinatra application.
# app.rb
require 'sinatra'
configure do
enable :sessions
end
get '/' do
if session[:user_id]
"OK"
else
raise "NOT OK!"
end
end
To test this you need to make a re...
Written by Sean Behan on 08/22/2013
Renaming Routes in Rails 3 with :As and :Controller
Renaming routes in Rails 2.* is straight forward. It goes something like this.
## config/routes.rb
map.resources :users, :as => :members
This will give you users_path and form_for(User.new) helpers, for instance, mapping the url to /members instead of ...
Written by Sean Behan on 06/17/2012
Natural Dog Training
Natural Dog Training uses Wordpress to run a blog and content management system.
Custom design, theme and plugin development
Written by Sean Behan on 06/17/2012
A Through Z
How to print the alphabet in Rails very easily.
("A".."Z").each {|letter| link_to letter, "/#{letter"}
"A".upto("Z") {|letter| link_to letter, "/#letter"}
Written by Sean Behan on 06/17/2012