I hereby claim:
- I am mattrw89 on github.
- I am mattw (https://keybase.io/mattw) on keybase.
- I have a public key whose fingerprint is B09F 5100 3799 7551 6B4B 5B40 CD56 2D87 A1F2 384E
To claim this, I am signing this object:
class ContactAssignmentsController < ApplicationController | |
def create | |
@organization = Organization.find(params[:org_id]) | |
# @keyword = SmsKeyword.find(params[:keyword]) | |
@question_sheets = @organization.question_sheets | |
ContactAssignment.where(:person_id => params[:ids], :question_sheet_id => @question_sheets).destroy_all | |
if params[:assign_to].present? | |
@assign_to = Person.find(params[:assign_to]) | |
params[:ids].each do |id| | |
#made it loop through question_sheets, so that all question_sheets are assigned to one person. not sure if this is the desired outcome. need to modify the counts if you want to do this. |
factory :person_with_things, :parent => :person do | |
after_create do |f| | |
Factory(:friend, :person => f) | |
Factory(:friend, :person => f) | |
Factory(:friend, :person => f) | |
Factory(:education_history_highschool, :person => f) | |
Factory(:education_history_college, :person => f) | |
Factory(:education_history_gradschool, :person => f) | |
Factory(:interest, :person => f) | |
Factory(:interest_2, :person => f) |
@people.each do |person| | |
@questions.each do |q| | |
@answer_sheets[person] = person.answer_sheets.select {|as| q.question_sheets.collect(&:id).include?(as.question_sheet_id)}.flatten.uniq | |
logger.info @answer_sheets[person].collect {|x| q.display_response(x)}.inspect | |
logger.info @answer_sheets[person].inspect | |
#logger.info q.display_response(@answer_sheets[person]).inspect | |
end | |
end | |
def oauth_required(options = {}) | |
if scope = options.delete(:scope) | |
before_filter options do |controller| | |
if controller.oauth.authenticated? | |
if !controller.oauth.scope.strip.split.include?(scope) | |
controller.send :head, controller.oauth.no_scope!(scope) | |
end | |
else | |
controller.send :head, controller.oauth.no_access! | |
end |
Matt-Webbs-MacBook-Pro:missionhub doulos$ git commit -am "more api tests + fix phone_number&email_address output in people api" | |
[master a6188a2] more api tests + fix phone_number&email_address output in people api | |
5 files changed, 134 insertions(+), 40 deletions(-) | |
rewrite app/controllers/api/contact_assignments_controller.rb (60%) | |
Matt-Webbs-MacBook-Pro:missionhub doulos$ git pull | |
Already up-to-date. | |
Matt-Webbs-MacBook-Pro:missionhub doulos$ git push | |
Counting objects: 27, done. | |
Delta compression using up to 8 threads. | |
Compressing objects: 100% (13/13), done. |
csd | |
* executing `staging' | |
* executing `deploy' | |
* executing `deploy:update' | |
** transaction: start | |
* executing `deploy:update_code' | |
updating the cached checkout on all servers | |
executing locally: "git ls-remote https://github.com/twinge/missionhub.git master" | |
command finished in 1098ms | |
* executing "if [ -d /var/www/html/integration/mh/shared/cached-copy ]; then cd /var/www/html/integration/mh/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 1a756b2267929f2ee3bec4977099c480638860f4 && git submodule -q init && for mod in `git submodule status | awk '{ print $2 }'`; do git config -f .git/config submodule.${mod}.url `git config -f .gitmodules --get submodule.${mod}.url` && echo Synced $mod; done && git submodule -q sync && git submodule -q update --init --recursive && git clean -q -d -x -f; else git clone -q https://github.com/twinge/missionhub.git /var/www/html/integration/mh/shared/cached-copy && cd /var/www/html/integration/mh/shared/cached-cop |
class ApiController < ApplicationController | |
require 'api_errors' | |
include ApiErrors | |
################################################################################# | |
#####CODE FROM http://www.starkiller.net/2011/03/17/versioned-api-1/ ########### | |
################################################################################# | |
@@versions = {} | |
@@registered_methods = {} | |
class << self |
I hereby claim:
To claim this, I am signing this object:
// ---- | |
// Sass (v3.3.7) | |
// Compass (v1.0.0.alpha.18) | |
// ---- | |
@mixin triangle($height, $length, $color) { | |
width: 0; | |
height: 0; | |
border-top: $height/2 solid transparent; | |
border-left: $length solid $color; |
It's pretty easy to do polymorphic associations in Rails: A Picture can belong to either a BlogPost or an Article. But what if you need the relationship the other way around? A Picture, a Text and a Video can belong to an Article, and that article can find all media by calling @article.media
This example shows how to create an ArticleElement join model that handles the polymorphic relationship. To add fields that are common to all polymorphic models, add fields to the join model.