Skip to content

Instantly share code, notes, and snippets.

@elben
elben / polls-api-nfl.markdown
Last active August 29, 2015 14:11
Polls API for NFL

Documentation that covers the Polls API with constrained topics. The example poll below is powered a stream's constrained topics, and all keyword management will be through the streams UI.

How to create a poll powered by constrained topics (in development):

Poll API

Buildfile: build.xml
init:
compile:
[javac] Compiling 15 source files to /Users/shira/code/ooc/build/javac-classes
[javac] /Users/shira/code/ooc/src/org/ooc/frontend/parser/VersionBlockParser.java:124: cannot find symbol
[javac] symbol : method isEmpty()
[javac] location: class java.lang.String
[javac] if(!realName.isEmpty()) {
[elbenshira@dev theater]$ sudo python setup.py install
Password:
/usr/lib64/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'message_extractors'
warnings.warn(msg)
running install
running bdist_egg
running egg_info
writing requirements to theater2.egg-info/requires.txt
writing theater2.egg-info/PKG-INFO
writing top-level names to theater2.egg-info/top_level.txt
NoMethodError in StoreController#save_order
undefined method `pay_time' for #<Order:0x28f85ac>
RAILS_ROOT: /Users/shira/code/depot
Application Trace | Framework Trace | Full Trace
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.3/lib/active_record/attribute_methods.rb:260:in `method_missing'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.3/lib/active_record/validations.rb:397:in `block (2 levels) in validates_each'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.3/lib/active_record/validations.rb:396:in `each'
session[:original_uri] = request.request_uri
...
# somewhere else
uri = session[:original_uri]
session[:original_uri] = nil
redirect_to(uri || { :action => "index" })
~/code/turn2live$ ruby script/server
=> Booting WEBrick
=> Rails 2.3.3 application starting on http://0.0.0.0:3000
/Users/shira/code/turn2live/vendor/rails/railties/lib/initializer.rb:386:in `read': No such file or directory - /Users/shira/code/turn2live/config/environments/development.rb (Errno::ENOENT)
from /Users/shira/code/turn2live/vendor/rails/railties/lib/initializer.rb:386:in `block in load_environment'
from /Users/shira/code/turn2live/vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from /Users/shira/code/turn2live/vendor/rails/railties/lib/initializer.rb:379:in `load_environment'
from /Users/shira/code/turn2live/vendor/rails/railties/lib/initializer.rb:137:in `process'
from /Users/shira/code/turn2live/vendor/rails/railties/lib/initializer.rb:113:in `run'
from /Users/shira/code/turn2live/config/environment.rb:13:in `<top (required)>'
NoMethodError in Admin/genres#index
Showing app/views/admin/genres/_list.html.erb where line #22 raised:
undefined method `resources' for #<Genre id: 1, name: "Easy Listening", type: nil, resource: nil>
Extracted source (around line #22):
19: <%= link_to 'destroy', admin_genre_path(genre), :method => 'delete', :confirm => 'Are you sure?' %>
20: </td>
NoMethodError in Admin/events#index
Showing app/views/admin/events/index.html.erb where line #33 raised:
undefined method `name' for nil:NilClass
Extracted source (around line #33):
30: <td><%= event.festival.try(:acronym) %></td>
31: <td>
class User < ActiveRecord::Base
attr_accessor :role
has_many :user_roles, :dependent => :destroy
has_many :roles, :through => :user_roles
after_save :set_role
def set_role
if @role # NOTE (A): @role is nil. I want it to be params[:user][:role].
# NOTE (B): do stuff here, mostly:
self.roles << @role
# unittest.py
class TestProgram:
def __init__(...):
...
self.runTests()
main = TestProgram