$ rails g model User
belongs_to
has_one
it "sorts the applications by the stage" do | |
+ first_stage = create(:phone_interview_stage, :hiring_plan => hiring_plan) | |
+ second_stage = create(:face_to_face_stage, :hiring_plan => hiring_plan) | |
+ | |
+ first_application = create(:application) | |
+ first_application.current_application_stage = ApplicationStage.create(hiring_plan_interview_stage: first_stage, application: first_application) | |
+ first_application.save! | |
+ second_application = create(:application) | |
+ second_application.current_application_stage = ApplicationStage.create(hiring_plan_interview_stage: second_stage, application: second_application) | |
+ second_application.save! |
module.exports = (config) -> | |
config.set({ | |
# base path, that will be used to resolve files and exclude | |
basePath: '../' | |
frameworks: ['jasmine', 'mocha', 'chai'], | |
files: [ | |
{pattern: 'app/**/*.js', included: true, served: true, watched: false} | |
{pattern: 'tests/**/*.js', included: true, served: true, watched: false} |
gulp = require 'gulp' | |
coffee = require 'gulp-coffee' | |
coffeelint = require 'gulp-coffeelint' | |
compass = require 'gulp-compass' | |
connect = require 'gulp-connect' | |
cached = require 'gulp-cached' | |
clean = require 'gulp-clean' | |
rjs = require 'gulp-requirejs' | |
karma = require('karma').server | |
karmaRunner = require('karma').runner |
post '/ivrs/:id/trigger' do | |
p "here #{params}" | |
parameters = {to: params[:To], | |
from: params[:From], | |
answer_url: "#{ENV['SERVER_NAME']}/ivrs/#{params[:id]}/play", | |
} | |
res = Plivo::RestAPI.new("#{ENV['PLIVO_AUTH_ID']}", "#{ENV['PLIVO_AUTH_TOKEN']}").make_call(parameters) | |
end | |
post '/ivrs/:id/play' do |
def build_response(from, commands) | |
response = Plivo::Response.new | |
commands.map do |c| | |
case c[:cmd] | |
when :reject | |
response.addHangup(reason: 'busy') | |
when :ivr | |
response.addHangup(reason: 'busy') | |
dial = response.addDial(callerId: from) | |
dial.addNumber(c[:to]) |
There are three questions I have. | |
1. Is it a good practice to massage the data when save it back to the database? | |
In my case, my params passed back from view looks like {"auto_text"=>"When the wheels come down?", "keyoption"=>{"1"=>{"key"=>"1", "option"=>"2"}}} | |
and I will break hashes and straighten it to a String which is the :read_text property in Ivr. | |
I am thinking if I should let Ivr has the key:option pair as it is, and generate the String when needed. | |
Then I can do presence validation and update later. | |
2. With Struct way, I don't know how to put it in my model. | |
3. With long string way, I don't know how to generate and assign back to the property. |
#asks | |
%h2= "ASKS" | |
-@campaign.asks.each do |ask| | |
=haml :ask, locals: {ask: ask, type: ask.class.typesym} | |
-if @campaign.asks.select{|n| n.triggered_ask && n.triggered_ask == ask}.empty? | |
%form{action: "/campaign/#{@campaign.id}/broadcast}", method: "post"} | |
%button{type: 'submit'} Launch the Ask | |
%form{action: "/campaign/#{@campaign.id}/add_new_ask", method: 'get'} | |
%button Add new ask |
#!/bin/sh | |
# | |
# We have a few repeat customers here at the TWU 27 hotdog shack. | |
# | |
# They've decided it's FUN to visit our stand. | |
# | |
# So, we've cooked up something a little special for our valued customers. | |
set -e |