Skip to content

Instantly share code, notes, and snippets.

class Article < ActiveRecord::Base
after_create :submit_to_crossref
include Crossref
end
module Crossref
private
def submit_to_crossref
# call helpers to format and submit the request
class Article < ActiveRecord::Base
after_create :submit_to_crossref
private
def submit_to_crossref
# convert article to xml
# format a crossref request
# connect to crossref using net/http
end
class ArticleTest < ActiveSupport::TestCase
should_validate_presence_of :title, :abstract, :body, :author
should "submit to crossref after being saved" do
title = 'a title'
# other constants
# expectations for net/http
Factory(:article, :title => title, ...)
end
end
class Article < ActiveRecord::Base
validates_presence_of :title, :abstract, :body, :author
end
class ArticleTest < ActiveSupport::TestCase
should_validate_presence_of :title, :abstract, :body, :author
end
form#new_user #first_name.text_field input {
float: left;
clear: both;
}
input {
float: left;
clear: both;
}
<div>
<%= form.label :location %>
<%= form.select :location, Location::ALL, :include_blank => true %>
</div>
<div>
<%= form.label :location %>
<%= form.select :location, Location::ALL %>
</div>
<div>
<%= form.label :title %>
<%= form.text_field :title %>
</div>