survey_says 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,13 +11,15 @@ The goal is to allow the questionnaire to be:
11
11
 
12
12
  = Install
13
13
 
14
- gem 'survey_says', :git => 'git://github.com:drhenner/survey_says.git'
14
+ gem 'survey_says', :git => 'git://github.com/drhenner/survey_says.git'
15
15
 
16
16
  move assets into your app
17
- rails generate survey_says
17
+
18
+ rails generate survey_says
18
19
 
19
20
  move models into your app
20
- rails generate survey_models
21
+
22
+ rails generate survey_models
21
23
 
22
24
  --------
23
25
 
@@ -25,7 +27,7 @@ add PAPERCLIP_STORAGE_OPTS to environments/*.rb
25
27
 
26
28
  for example:
27
29
 
28
- PAPERCLIP_STORAGE_OPTS = { :styles => {:mini => '48x48>',
30
+ PAPERCLIP_STORAGE_OPTS = { :styles => {:mini => '48x48>',
29
31
  :small => '100x100>',
30
32
  :product => '320x320>',
31
33
  :large => '600x600>' },
@@ -36,18 +38,18 @@ PAPERCLIP_STORAGE_OPTS = { :styles => {:mini => '48x48>',
36
38
  Edit the user.rb in your app:
37
39
 
38
40
 
39
- has_many :user_answers
40
- has_many :answers, :through => :user_answers
41
+ has_many :user_answers
42
+ has_many :answers, :through => :user_answers
41
43
 
42
- acts_as_survey_says
44
+ acts_as_survey_says
43
45
 
44
- def survey_admin?
45
- true # add code here... return true for users that can add/edit the survey information
46
- end
46
+ def survey_admin?
47
+ true # add code here... return true for users that can add/edit the survey information
48
+ end
47
49
 
48
50
  --------
49
51
 
50
- bundle exec rake railties:install:migrations
52
+ bundle exec rake survey_says_engine:install:migrations
51
53
 
52
54
  = Contribute
53
55
 
@@ -20,7 +20,7 @@
20
20
  <ul style='padding:10px;'>
21
21
  <li style='margin-bottom:10px;'><%= link_to "Questionnaires", survey_admin_questionnaires_path() %></li>
22
22
  <li style='margin-bottom:10px;'><%= link_to "Questions", survey_admin_questions_path() %></li>
23
- <% if @question.try(:id) || @answer.try(:id) %>
23
+ <% if @question.try(:id) %>
24
24
  <li style='margin-bottom:10px;'>
25
25
  <%= link_to "Answers", survey_admin_question_answers_path(@question) %>
26
26
  </li>
@@ -1,3 +1,3 @@
1
1
  module SurveySays
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,12 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ has_many :user_answers
4
+ has_many :answers, :through => :user_answers
5
+
6
+ acts_as_survey_says
7
+
8
+ def survey_admin?
9
+ true
10
+ end
11
+
12
+ end
@@ -14,14 +14,16 @@
14
14
  ActiveRecord::Schema.define(:version => 20111213185612) do
15
15
 
16
16
  create_table "answers", :force => true do |t|
17
- t.integer "question_id"
17
+ t.integer "question_id", :null => false
18
18
  t.text "details"
19
- t.boolean "active"
19
+ t.boolean "active", :default => true
20
20
  t.integer "position"
21
21
  t.datetime "created_at"
22
22
  t.datetime "updated_at"
23
23
  end
24
24
 
25
+ add_index "answers", ["question_id"], :name => "index_answers_on_question_id"
26
+
25
27
  create_table "questionnaires", :force => true do |t|
26
28
  t.string "name", :null => false
27
29
  end
@@ -29,8 +31,8 @@ ActiveRecord::Schema.define(:version => 20111213185612) do
29
31
  add_index "questionnaires", ["name"], :name => "index_questionnaires_on_name"
30
32
 
31
33
  create_table "questions", :force => true do |t|
32
- t.text "details"
33
- t.boolean "active"
34
+ t.text "details", :null => false
35
+ t.boolean "active", :default => true
34
36
  t.integer "position"
35
37
  t.datetime "created_at"
36
38
  t.datetime "updated_at"
@@ -40,13 +42,16 @@ ActiveRecord::Schema.define(:version => 20111213185612) do
40
42
  add_index "questions", ["questionnaire_id"], :name => "index_questions_on_questionnaire_id"
41
43
 
42
44
  create_table "scores", :force => true do |t|
43
- t.integer "answer_id"
44
- t.integer "survey_property_id"
45
- t.integer "value"
45
+ t.integer "answer_id", :null => false
46
+ t.integer "survey_property_id", :null => false
47
+ t.integer "value", :null => false
46
48
  t.datetime "created_at"
47
49
  t.datetime "updated_at"
48
50
  end
49
51
 
52
+ add_index "scores", ["answer_id"], :name => "index_scores_on_answer_id"
53
+ add_index "scores", ["survey_property_id"], :name => "index_scores_on_survey_property_id"
54
+
50
55
  create_table "survey_images", :force => true do |t|
51
56
  t.integer "imageable_id"
52
57
  t.string "imageable_type"
@@ -60,7 +65,7 @@ ActiveRecord::Schema.define(:version => 20111213185612) do
60
65
  end
61
66
 
62
67
  create_table "survey_properties", :force => true do |t|
63
- t.string "name"
68
+ t.string "name", :null => false
64
69
  t.datetime "created_at"
65
70
  t.datetime "updated_at"
66
71
  end
Binary file
@@ -11106,3 +11106,256 @@ Served asset /survey_says.js - 200 OK (0ms)
11106
11106
 
11107
11107
  Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-12-14 03:53:30 -0500
11108
11108
  Served asset /jquery.js - 304 Not Modified (2ms)
11109
+  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11110
+ Migrating to CreateUsers (20111010112000)
11111
+ Migrating to CreateQuestions (20111208181247)
11112
+ Migrating to CreateAnswers (20111208181414)
11113
+ Migrating to CreateSurveyProperties (20111208181429)
11114
+ Migrating to CreateScores (20111208181449)
11115
+ Migrating to CreateUserAnswers (20111211175518)
11116
+ Migrating to CreateQuestionnaires (20111211175604)
11117
+ Migrating to AddQuestionaireIdToQuestions (20111211180011)
11118
+ Migrating to CreateSurveyImages (20111213185612)
11119
+  (0.3ms) select sqlite_version(*)
11120
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11121
+  (0.0ms) PRAGMA index_list("answers")
11122
+  (0.0ms) PRAGMA index_list("questionnaires")
11123
+  (0.0ms) PRAGMA index_info('index_questionnaires_on_name')
11124
+  (0.0ms) PRAGMA index_list("questions")
11125
+  (0.0ms) PRAGMA index_info('index_questions_on_questionnaire_id')
11126
+  (0.0ms) PRAGMA index_list("scores")
11127
+  (0.0ms) PRAGMA index_list("survey_images")
11128
+  (0.0ms) PRAGMA index_list("survey_properties")
11129
+  (0.0ms) PRAGMA index_list("user_answers")
11130
+  (0.0ms) PRAGMA index_info('index_user_answers_on_answer_id')
11131
+  (0.0ms) PRAGMA index_info('index_user_answers_on_user_id')
11132
+  (0.0ms) PRAGMA index_list("users")
11133
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11134
+ Migrating to CreateUsers (20111010112000)
11135
+  (0.3ms) select sqlite_version(*)
11136
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11137
+  (0.0ms) PRAGMA index_list("answers")
11138
+  (0.0ms) PRAGMA index_list("questionnaires")
11139
+  (0.0ms) PRAGMA index_info('index_questionnaires_on_name')
11140
+  (0.0ms) PRAGMA index_list("questions")
11141
+  (0.0ms) PRAGMA index_info('index_questions_on_questionnaire_id')
11142
+  (0.0ms) PRAGMA index_list("scores")
11143
+  (0.0ms) PRAGMA index_list("survey_images")
11144
+  (0.0ms) PRAGMA index_list("survey_properties")
11145
+  (0.0ms) PRAGMA index_list("user_answers")
11146
+  (0.0ms) PRAGMA index_info('index_user_answers_on_answer_id')
11147
+  (0.0ms) PRAGMA index_info('index_user_answers_on_user_id')
11148
+  (0.0ms) PRAGMA index_list("users")
11149
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11150
+  (0.2ms) select sqlite_version(*)
11151
+  (1.4ms) CREATE TABLE "answers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "question_id" integer, "details" text, "active" boolean, "position" integer, "created_at" datetime, "updated_at" datetime) 
11152
+  (1.1ms) CREATE TABLE "questionnaires" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL)
11153
+  (0.0ms) PRAGMA index_list("questionnaires")
11154
+  (1.1ms) CREATE INDEX "index_questionnaires_on_name" ON "questionnaires" ("name")
11155
+  (1.0ms) CREATE TABLE "questions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "details" text, "active" boolean, "position" integer, "created_at" datetime, "updated_at" datetime, "questionnaire_id" integer) 
11156
+  (0.0ms) PRAGMA index_list("questions")
11157
+  (1.1ms) CREATE INDEX "index_questions_on_questionnaire_id" ON "questions" ("questionnaire_id")
11158
+  (0.9ms) CREATE TABLE "scores" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer_id" integer, "survey_property_id" integer, "value" integer, "created_at" datetime, "updated_at" datetime)
11159
+  (1.2ms) CREATE TABLE "survey_images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "imageable_id" integer, "imageable_type" varchar(255), "position" integer, "photo_file_name" varchar(255), "photo_content_type" varchar(255), "photo_file_size" integer, "caption" varchar(255), "created_at" datetime, "updated_at" datetime) 
11160
+  (1.3ms) CREATE TABLE "survey_properties" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
11161
+  (1.1ms) CREATE TABLE "user_answers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer NOT NULL, "answer_id" integer NOT NULL, "created_at" datetime, "updated_at" datetime) 
11162
+  (0.0ms) PRAGMA index_list("user_answers")
11163
+  (1.0ms) CREATE INDEX "index_user_answers_on_answer_id" ON "user_answers" ("answer_id")
11164
+  (0.0ms) PRAGMA index_list("user_answers")
11165
+  (0.0ms) PRAGMA index_info('index_user_answers_on_answer_id')
11166
+  (0.9ms) CREATE INDEX "index_user_answers_on_user_id" ON "user_answers" ("user_id")
11167
+  (1.0ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
11168
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
11169
+  (0.0ms) PRAGMA index_list("schema_migrations")
11170
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
11171
+  (0.1ms) SELECT version FROM "schema_migrations"
11172
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20111213185612')
11173
+  (1.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20111010112000')
11174
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11175
+ Migrating to CreateUsers (20111010112000)
11176
+  (0.3ms) select sqlite_version(*)
11177
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11178
+  (0.0ms) PRAGMA index_list("answers")
11179
+  (0.0ms) PRAGMA index_list("questionnaires")
11180
+  (0.0ms) PRAGMA index_info('index_questionnaires_on_name')
11181
+  (0.0ms) PRAGMA index_list("questions")
11182
+  (0.0ms) PRAGMA index_info('index_questions_on_questionnaire_id')
11183
+  (0.0ms) PRAGMA index_list("scores")
11184
+  (0.0ms) PRAGMA index_list("survey_images")
11185
+  (0.0ms) PRAGMA index_list("survey_properties")
11186
+  (0.0ms) PRAGMA index_list("user_answers")
11187
+  (0.0ms) PRAGMA index_info('index_user_answers_on_answer_id')
11188
+  (0.0ms) PRAGMA index_info('index_user_answers_on_user_id')
11189
+  (0.0ms) PRAGMA index_list("users")
11190
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11191
+ Migrating to CreateUsers (20111010112000)
11192
+ Migrating to CreateQuestions (20111208181247)
11193
+ Migrating to CreateAnswers (20111208181414)
11194
+ Migrating to CreateSurveyProperties (20111208181429)
11195
+ Migrating to CreateScores (20111208181449)
11196
+ Migrating to CreateUserAnswers (20111211175518)
11197
+ Migrating to CreateQuestionnaires (20111211175604)
11198
+ Migrating to AddQuestionaireIdToQuestions (20111211180011)
11199
+ Migrating to CreateSurveyImages (20111213185612)
11200
+  (0.3ms) select sqlite_version(*)
11201
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11202
+  (0.0ms) PRAGMA index_list("answers")
11203
+  (0.0ms) PRAGMA index_list("questionnaires")
11204
+  (0.0ms) PRAGMA index_info('index_questionnaires_on_name')
11205
+  (0.0ms) PRAGMA index_list("questions")
11206
+  (0.0ms) PRAGMA index_info('index_questions_on_questionnaire_id')
11207
+  (0.0ms) PRAGMA index_list("scores")
11208
+  (0.0ms) PRAGMA index_list("survey_images")
11209
+  (0.0ms) PRAGMA index_list("survey_properties")
11210
+  (0.0ms) PRAGMA index_list("user_answers")
11211
+  (0.0ms) PRAGMA index_info('index_user_answers_on_answer_id')
11212
+  (0.0ms) PRAGMA index_info('index_user_answers_on_user_id')
11213
+  (0.0ms) PRAGMA index_list("users")
11214
+  (0.1ms) select sqlite_version(*)
11215
+  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
11216
+  (0.0ms) PRAGMA index_list("schema_migrations")
11217
+  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
11218
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11219
+ Migrating to CreateUsers (20111010112000)
11220
+  (0.4ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
11221
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20111010112000')
11222
+ Migrating to CreateQuestions (20111208181247)
11223
+  (0.4ms) CREATE TABLE "questions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "details" text NOT NULL, "active" boolean DEFAULT 't', "position" integer, "created_at" datetime, "updated_at" datetime)
11224
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20111208181247')
11225
+ Migrating to CreateAnswers (20111208181414)
11226
+  (0.3ms) CREATE TABLE "answers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "question_id" integer NOT NULL, "details" text, "active" boolean DEFAULT 't', "position" integer, "created_at" datetime, "updated_at" datetime)
11227
+  (0.0ms) PRAGMA index_list("answers")
11228
+  (0.1ms) CREATE INDEX "index_answers_on_question_id" ON "answers" ("question_id")
11229
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20111208181414')
11230
+ Migrating to CreateSurveyProperties (20111208181429)
11231
+  (0.3ms) CREATE TABLE "survey_properties" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime)
11232
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20111208181429')
11233
+ Migrating to CreateScores (20111208181449)
11234
+  (0.3ms) CREATE TABLE "scores" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer_id" integer NOT NULL, "survey_property_id" integer NOT NULL, "value" integer NOT NULL, "created_at" datetime, "updated_at" datetime)
11235
+  (0.0ms) PRAGMA index_list("scores")
11236
+  (0.1ms) CREATE INDEX "index_scores_on_answer_id" ON "scores" ("answer_id")
11237
+  (0.0ms) PRAGMA index_list("scores")
11238
+  (0.0ms) PRAGMA index_info('index_scores_on_answer_id')
11239
+  (0.1ms) CREATE INDEX "index_scores_on_survey_property_id" ON "scores" ("survey_property_id")
11240
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20111208181449')
11241
+ Migrating to CreateUserAnswers (20111211175518)
11242
+  (0.3ms) CREATE TABLE "user_answers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer NOT NULL, "answer_id" integer NOT NULL, "created_at" datetime, "updated_at" datetime) 
11243
+  (0.0ms) PRAGMA index_list("user_answers")
11244
+  (0.1ms) CREATE INDEX "index_user_answers_on_user_id" ON "user_answers" ("user_id")
11245
+  (0.0ms) PRAGMA index_list("user_answers")
11246
+  (0.0ms) PRAGMA index_info('index_user_answers_on_user_id')
11247
+  (0.1ms) CREATE INDEX "index_user_answers_on_answer_id" ON "user_answers" ("answer_id")
11248
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20111211175518')
11249
+ Migrating to CreateQuestionnaires (20111211175604)
11250
+  (0.3ms) CREATE TABLE "questionnaires" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL)
11251
+  (0.0ms) PRAGMA index_list("questionnaires")
11252
+  (0.1ms) CREATE INDEX "index_questionnaires_on_name" ON "questionnaires" ("name")
11253
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20111211175604')
11254
+ Migrating to AddQuestionaireIdToQuestions (20111211180011)
11255
+  (0.6ms) ALTER TABLE "questions" ADD "questionnaire_id" integer
11256
+  (0.1ms) PRAGMA index_list("questions")
11257
+  (0.2ms) CREATE INDEX "index_questions_on_questionnaire_id" ON "questions" ("questionnaire_id")
11258
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20111211180011')
11259
+ Migrating to CreateSurveyImages (20111213185612)
11260
+  (0.4ms) CREATE TABLE "survey_images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "imageable_id" integer, "imageable_type" varchar(255), "position" integer, "photo_file_name" varchar(255), "photo_content_type" varchar(255), "photo_file_size" integer, "caption" varchar(255), "created_at" datetime, "updated_at" datetime)
11261
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20111213185612')
11262
+  (0.3ms) select sqlite_version(*)
11263
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11264
+  (0.0ms) PRAGMA index_list("answers")
11265
+  (0.0ms) PRAGMA index_info('index_answers_on_question_id')
11266
+  (0.0ms) PRAGMA index_list("questionnaires")
11267
+  (0.0ms) PRAGMA index_info('index_questionnaires_on_name')
11268
+  (0.0ms) PRAGMA index_list("questions")
11269
+  (0.0ms) PRAGMA index_info('index_questions_on_questionnaire_id')
11270
+  (0.0ms) PRAGMA index_list("scores")
11271
+  (0.0ms) PRAGMA index_info('index_scores_on_survey_property_id')
11272
+  (0.0ms) PRAGMA index_info('index_scores_on_answer_id')
11273
+  (0.0ms) PRAGMA index_list("survey_images")
11274
+  (0.0ms) PRAGMA index_list("survey_properties")
11275
+  (0.0ms) PRAGMA index_list("user_answers")
11276
+  (0.0ms) PRAGMA index_info('index_user_answers_on_answer_id')
11277
+  (0.0ms) PRAGMA index_info('index_user_answers_on_user_id')
11278
+  (0.0ms) PRAGMA index_list("users")
11279
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11280
+ Migrating to CreateUsers (20111010112000)
11281
+  (0.3ms) select sqlite_version(*)
11282
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11283
+  (0.0ms) PRAGMA index_list("answers")
11284
+  (0.0ms) PRAGMA index_info('index_answers_on_question_id')
11285
+  (0.0ms) PRAGMA index_list("questionnaires")
11286
+  (0.0ms) PRAGMA index_info('index_questionnaires_on_name')
11287
+  (0.0ms) PRAGMA index_list("questions")
11288
+  (0.0ms) PRAGMA index_info('index_questions_on_questionnaire_id')
11289
+  (0.0ms) PRAGMA index_list("scores")
11290
+  (0.0ms) PRAGMA index_info('index_scores_on_survey_property_id')
11291
+  (0.0ms) PRAGMA index_info('index_scores_on_answer_id')
11292
+  (0.0ms) PRAGMA index_list("survey_images")
11293
+  (0.0ms) PRAGMA index_list("survey_properties")
11294
+  (0.0ms) PRAGMA index_list("user_answers")
11295
+  (0.0ms) PRAGMA index_info('index_user_answers_on_answer_id')
11296
+  (0.0ms) PRAGMA index_info('index_user_answers_on_user_id')
11297
+  (0.0ms) PRAGMA index_list("users")
11298
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11299
+  (0.2ms) select sqlite_version(*)
11300
+  (1.2ms) CREATE TABLE "answers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "question_id" integer NOT NULL, "details" text, "active" boolean DEFAULT 't', "position" integer, "created_at" datetime, "updated_at" datetime) 
11301
+  (0.1ms) PRAGMA index_list("answers")
11302
+  (0.7ms) CREATE INDEX "index_answers_on_question_id" ON "answers" ("question_id")
11303
+  (0.7ms) CREATE TABLE "questionnaires" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL)
11304
+  (0.0ms) PRAGMA index_list("questionnaires")
11305
+  (0.8ms) CREATE INDEX "index_questionnaires_on_name" ON "questionnaires" ("name")
11306
+  (0.9ms) CREATE TABLE "questions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "details" text NOT NULL, "active" boolean DEFAULT 't', "position" integer, "created_at" datetime, "updated_at" datetime, "questionnaire_id" integer) 
11307
+  (0.0ms) PRAGMA index_list("questions")
11308
+  (0.7ms) CREATE INDEX "index_questions_on_questionnaire_id" ON "questions" ("questionnaire_id")
11309
+  (0.9ms) CREATE TABLE "scores" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer_id" integer NOT NULL, "survey_property_id" integer NOT NULL, "value" integer NOT NULL, "created_at" datetime, "updated_at" datetime)
11310
+  (0.0ms) PRAGMA index_list("scores")
11311
+  (0.7ms) CREATE INDEX "index_scores_on_answer_id" ON "scores" ("answer_id")
11312
+  (0.0ms) PRAGMA index_list("scores")
11313
+  (0.0ms) PRAGMA index_info('index_scores_on_answer_id')
11314
+  (0.6ms) CREATE INDEX "index_scores_on_survey_property_id" ON "scores" ("survey_property_id")
11315
+  (0.8ms) CREATE TABLE "survey_images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "imageable_id" integer, "imageable_type" varchar(255), "position" integer, "photo_file_name" varchar(255), "photo_content_type" varchar(255), "photo_file_size" integer, "caption" varchar(255), "created_at" datetime, "updated_at" datetime)
11316
+  (0.8ms) CREATE TABLE "survey_properties" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) 
11317
+  (0.8ms) CREATE TABLE "user_answers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer NOT NULL, "answer_id" integer NOT NULL, "created_at" datetime, "updated_at" datetime)
11318
+  (0.0ms) PRAGMA index_list("user_answers")
11319
+  (0.7ms) CREATE INDEX "index_user_answers_on_answer_id" ON "user_answers" ("answer_id")
11320
+  (0.0ms) PRAGMA index_list("user_answers")
11321
+  (0.0ms) PRAGMA index_info('index_user_answers_on_answer_id')
11322
+  (0.7ms) CREATE INDEX "index_user_answers_on_user_id" ON "user_answers" ("user_id")
11323
+  (0.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
11324
+  (0.7ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
11325
+  (0.0ms) PRAGMA index_list("schema_migrations")
11326
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
11327
+  (0.1ms) SELECT version FROM "schema_migrations"
11328
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20111213185612')
11329
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20111010112000')
11330
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
11331
+  (0.2ms) select sqlite_version(*)
11332
+  (1.2ms) CREATE TABLE "answers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "question_id" integer NOT NULL, "details" text, "active" boolean DEFAULT 't', "position" integer, "created_at" datetime, "updated_at" datetime) 
11333
+  (0.0ms) PRAGMA index_list("answers")
11334
+  (0.8ms) CREATE INDEX "index_answers_on_question_id" ON "answers" ("question_id")
11335
+  (1.3ms) CREATE TABLE "questionnaires" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL)
11336
+  (0.0ms) PRAGMA index_list("questionnaires")
11337
+  (0.8ms) CREATE INDEX "index_questionnaires_on_name" ON "questionnaires" ("name")
11338
+  (1.3ms) CREATE TABLE "questions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "details" text NOT NULL, "active" boolean DEFAULT 't', "position" integer, "created_at" datetime, "updated_at" datetime, "questionnaire_id" integer) 
11339
+  (0.0ms) PRAGMA index_list("questions")
11340
+  (1.0ms) CREATE INDEX "index_questions_on_questionnaire_id" ON "questions" ("questionnaire_id")
11341
+  (1.1ms) CREATE TABLE "scores" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer_id" integer NOT NULL, "survey_property_id" integer NOT NULL, "value" integer NOT NULL, "created_at" datetime, "updated_at" datetime)
11342
+  (0.0ms) PRAGMA index_list("scores")
11343
+  (0.9ms) CREATE INDEX "index_scores_on_answer_id" ON "scores" ("answer_id")
11344
+  (0.0ms) PRAGMA index_list("scores")
11345
+  (0.0ms) PRAGMA index_info('index_scores_on_answer_id')
11346
+  (1.2ms) CREATE INDEX "index_scores_on_survey_property_id" ON "scores" ("survey_property_id")
11347
+  (1.0ms) CREATE TABLE "survey_images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "imageable_id" integer, "imageable_type" varchar(255), "position" integer, "photo_file_name" varchar(255), "photo_content_type" varchar(255), "photo_file_size" integer, "caption" varchar(255), "created_at" datetime, "updated_at" datetime)
11348
+  (1.2ms) CREATE TABLE "survey_properties" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) 
11349
+  (0.8ms) CREATE TABLE "user_answers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer NOT NULL, "answer_id" integer NOT NULL, "created_at" datetime, "updated_at" datetime)
11350
+  (0.0ms) PRAGMA index_list("user_answers")
11351
+  (0.7ms) CREATE INDEX "index_user_answers_on_answer_id" ON "user_answers" ("answer_id")
11352
+  (0.0ms) PRAGMA index_list("user_answers")
11353
+  (0.0ms) PRAGMA index_info('index_user_answers_on_answer_id')
11354
+  (1.0ms) CREATE INDEX "index_user_answers_on_user_id" ON "user_answers" ("user_id")
11355
+  (1.1ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
11356
+  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
11357
+  (0.0ms) PRAGMA index_list("schema_migrations")
11358
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
11359
+  (0.1ms) SELECT version FROM "schema_migrations"
11360
+  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20111213185612')
11361
+  (1.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20111010112000')
@@ -1,5 +1,5 @@
1
1
  Factory.define :question do |s|
2
- s.details 'John'
2
+ s.details 'John blah blah blah'
3
3
  s.active true
4
4
  s.position 1
5
5
  end
@@ -3,7 +3,7 @@ Factory.define :survey_image do |s|
3
3
  s.imageable { |c| c.association(:answer) }
4
4
  s.position 1
5
5
  s.photo_file_name 'My-file-name'
6
- s.photo_content_type: 'image/jpeg'
7
- s.photo_file_size: 1
8
- s.caption: 'My caption... '
6
+ s.photo_content_type 'image/jpeg'
7
+ s.photo_file_size 1
8
+ s.caption 'My caption... '
9
9
  end
@@ -46,7 +46,8 @@ class SurveyAdmin::AnswersControllerTest < ActionController::TestCase
46
46
  end
47
47
 
48
48
  def test_update_invalid
49
- @question = Factory(:question)
49
+ @question = FactoryGirl.create(:question)
50
+ puts @question.inspect
50
51
  @answer = Factory(:answer, :question => @question)
51
52
  Answer.any_instance.stubs(:valid?).returns(false)
52
53
  put :update, :id => @answer.id, :question_id => @question.id
@@ -54,7 +55,7 @@ class SurveyAdmin::AnswersControllerTest < ActionController::TestCase
54
55
  end
55
56
 
56
57
  def test_update_valid
57
- @question = Factory(:question)
58
+ @question = FactoryGirl.create(:question)
58
59
  @answer = Factory(:answer, :question => @question)
59
60
  Answer.any_instance.stubs(:valid?).returns(true)
60
61
  put :update, :id => @answer.id, :question_id => @question.id
@@ -21,13 +21,13 @@ class SurveyAdmin::QuestionsControllerTest < ActionController::TestCase
21
21
 
22
22
  def test_create_invalid
23
23
  Question.any_instance.stubs(:valid?).returns(false)
24
- post :create
24
+ post :create, :question => {:details => 'hello'}
25
25
  assert_template 'new'
26
26
  end
27
27
 
28
28
  def test_create_valid
29
29
  Question.any_instance.stubs(:valid?).returns(true)
30
- post :create
30
+ post :create, :question => {:details => 'hello'}
31
31
  assert_redirected_to survey_admin_question_answers_url(assigns(:question))
32
32
  end
33
33
 
@@ -40,14 +40,14 @@ class SurveyAdmin::QuestionsControllerTest < ActionController::TestCase
40
40
  def test_update_invalid
41
41
  question = Factory(:question)
42
42
  Question.any_instance.stubs(:valid?).returns(false)
43
- put :update, :id => question.id
43
+ put :update, :id => question.id, :question => {:details => 'hello'}
44
44
  assert_template 'edit'
45
45
  end
46
46
 
47
47
  def test_update_valid
48
48
  question = Factory(:question)
49
49
  Question.any_instance.stubs(:valid?).returns(true)
50
- put :update, :id => question.id
50
+ put :update, :id => question.id, :question => {:details => 'hello'}
51
51
  assert_redirected_to survey_admin_question_answers_url(assigns(:question))
52
52
  end
53
53
 
@@ -20,13 +20,13 @@ class SurveyAdmin::SurveyPropertiesControllerTest < ActionController::TestCase
20
20
 
21
21
  def test_create_invalid
22
22
  SurveyProperty.any_instance.stubs(:valid?).returns(false)
23
- post :create
23
+ post :create, :survey_property => {:name => 'hello'}
24
24
  assert_template 'new'
25
25
  end
26
26
 
27
27
  def test_create_valid
28
28
  SurveyProperty.any_instance.stubs(:valid?).returns(true)
29
- post :create
29
+ post :create, :survey_property => {:name => 'hello'}
30
30
  assert_redirected_to survey_admin_survey_property_url(assigns(:survey_property))
31
31
  end
32
32
 
@@ -39,14 +39,14 @@ class SurveyAdmin::SurveyPropertiesControllerTest < ActionController::TestCase
39
39
  def test_update_invalid
40
40
  @survey_property = Factory(:survey_property)
41
41
  SurveyProperty.any_instance.stubs(:valid?).returns(false)
42
- put :update, :id => @survey_property.id
42
+ put :update, :id => @survey_property.id, :survey_property => {:name => 'hello'}
43
43
  assert_template 'edit'
44
44
  end
45
45
 
46
46
  def test_update_valid
47
47
  @survey_property = Factory(:survey_property)
48
48
  SurveyProperty.any_instance.stubs(:valid?).returns(true)
49
- put :update, :id => @survey_property.id
49
+ put :update, :id => @survey_property.id, :survey_property => {:name => 'hello'}
50
50
  assert_redirected_to survey_admin_survey_property_url(assigns(:survey_property))
51
51
  end
52
52
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: survey_says
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - David Henner
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-12-15 00:00:00 -05:00
14
- default_executable:
13
+ date: 2012-08-23 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: rails
@@ -149,7 +148,6 @@ files:
149
148
  - app/views/survey_admin/survey_properties/new.html.erb
150
149
  - app/views/survey_admin/survey_properties/show.html.erb
151
150
  - config/routes.rb
152
- - db/development.sqlite3
153
151
  - db/migrate/20111208181247_create_questions.rb
154
152
  - db/migrate/20111208181414_create_answers.rb
155
153
  - db/migrate/20111208181429_create_survey_properties.rb
@@ -176,6 +174,7 @@ files:
176
174
  - test/dummy/app/helpers/application_helper.rb
177
175
  - test/dummy/app/helpers/error_messages_helper.rb
178
176
  - test/dummy/app/helpers/layout_helper.rb
177
+ - test/dummy/app/models/user.rb
179
178
  - test/dummy/app/views/layouts/application.html.erb
180
179
  - test/dummy/config/application.rb
181
180
  - test/dummy/config/boot.rb
@@ -279,7 +278,6 @@ files:
279
278
  - test/unit/survey_image_test.rb
280
279
  - test/unit/survey_property_test.rb
281
280
  - test/unit/user_answer_test.rb
282
- has_rdoc: true
283
281
  homepage: http://www.ror-e.com
284
282
  licenses: []
285
283
 
@@ -303,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
301
  requirements: []
304
302
 
305
303
  rubyforge_project:
306
- rubygems_version: 1.6.2
304
+ rubygems_version: 1.8.15
307
305
  signing_key:
308
306
  specification_version: 3
309
307
  summary: This is a plugin that allows you to create a questionaire with custom scores.
@@ -315,6 +313,7 @@ test_files:
315
313
  - test/dummy/app/helpers/application_helper.rb
316
314
  - test/dummy/app/helpers/error_messages_helper.rb
317
315
  - test/dummy/app/helpers/layout_helper.rb
316
+ - test/dummy/app/models/user.rb
318
317
  - test/dummy/app/views/layouts/application.html.erb
319
318
  - test/dummy/config/application.rb
320
319
  - test/dummy/config/boot.rb
Binary file