save_and_open_page
have_button(locator)
# Doesn't work | |
<p> | |
<% case @request.author_hosted %> | |
<% when "yes" %> | |
The school <b>has</b> hosted an author before. | |
<% when "no" %> | |
The school <b>has not</b> hosted an author before. | |
<% end %> | |
</p> |
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.
# Ensure system is in ship-shape.
aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev
def mode(array) | |
counter = Hash.new(0) | |
# this creates a new, empty hash with no keys, but makes all defalt values zero. it will be used to store | |
# the information from the array, such that the keys will be each unique number from the array (IOW, if there | |
# are two or more 4's in the array, there will just be one key that is a 4), and the value for each key will | |
# be the number of times that integer appears in the array. | |
array.each do |i| | |
counter[i] += 1 | |
end | |
# this interates throught the array, and for each element it creates a key for that integer (if it hasn't been |
def select_date(date, options = {}) | |
field = options[:from] | |
base_id = find(:xpath, ".//label[contains(.,'#{field}')]")[:for] | |
year, month, day = date.split(',') | |
select year, :from => "#{base_id}_1i" | |
select month, :from => "#{base_id}_2i" | |
select day, :from => "#{base_id}_3i" | |
end | |
def select_time(hour, minute, options = {}) |
Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.
Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.
# | |
# This will force ActiveRecord to create proper `interval` column types in PostgreSQL | |
# | |
# def change | |
# add_column :leases, :period, :interval | |
# end | |
# | |
# This applies to a generated `schema.rb` file too. | |
# | |
# No special OID type is applied to an `interval` type. Rails will treat it as a string, although |