enju_question 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ class AnswersController < ApplicationController
3
3
  load_and_authorize_resource :except => :index
4
4
  authorize_resource :only => :index
5
5
  before_filter :store_location, :only => [:index, :show, :new, :edit]
6
- before_filter :get_user_if_nil, :except => [:edit]
6
+ before_filter :get_user, :except => [:edit]
7
7
  before_filter :get_question
8
8
  cache_sweeper :question_sweeper, :only => [:create, :update, :destroy]
9
9
 
@@ -85,7 +85,7 @@ class AnswersController < ApplicationController
85
85
  end
86
86
  end
87
87
 
88
- # GET /answers/1;edit
88
+ # GET /answers/1/edit
89
89
  def edit
90
90
  end
91
91
 
@@ -101,12 +101,12 @@ class AnswersController < ApplicationController
101
101
  respond_to do |format|
102
102
  if @answer.save
103
103
  flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.answer'))
104
- format.html { redirect_to(@answer) }
104
+ format.html { redirect_to @answer }
105
105
  format.json { render :json => @answer, :status => :created, :location => answer_url(@answer) }
106
106
  format.mobile { redirect_to question_url(@answer.question) }
107
107
  else
108
108
  format.html { render :action => "new" }
109
- format.json { render :json => @answer.errors.to_json }
109
+ format.json { render :json => @answer.errors, :status => :unprocessable_entity }
110
110
  format.mobile { render :action => "new" }
111
111
  end
112
112
  end
@@ -118,11 +118,11 @@ class AnswersController < ApplicationController
118
118
  respond_to do |format|
119
119
  if @answer.update_attributes(params[:answer])
120
120
  flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.answer'))
121
- format.html { redirect_to(@answer) }
122
- format.json { head :ok }
121
+ format.html { redirect_to @answer }
122
+ format.json { head :no_content }
123
123
  else
124
124
  format.html { render :action => "edit" }
125
- format.json { render :json => @answer.errors.to_json }
125
+ format.json { render :json => @answer.errors, :status => :unprocessable_entity }
126
126
  end
127
127
  end
128
128
  end
@@ -134,7 +134,7 @@ class AnswersController < ApplicationController
134
134
 
135
135
  respond_to do |format|
136
136
  format.html { redirect_to question_answers_url(@answer.question) }
137
- format.json { head :ok }
137
+ format.json { head :no_content }
138
138
  end
139
139
  end
140
140
  end
@@ -2,7 +2,7 @@
2
2
  class QuestionsController < ApplicationController
3
3
  before_filter :store_location, :only => [:index, :show, :new, :edit]
4
4
  load_and_authorize_resource
5
- before_filter :get_user_if_nil, :except => [:edit]
5
+ before_filter :get_user, :except => [:edit]
6
6
  after_filter :solr_commit, :only => [:create, :update, :destroy]
7
7
 
8
8
  # GET /questions
@@ -85,7 +85,7 @@ class QuestionsController < ApplicationController
85
85
 
86
86
  respond_to do |format|
87
87
  format.html # index.rhtml
88
- format.json { render :json => @questions.to_json }
88
+ format.json { render :json => @questions }
89
89
  format.xml {
90
90
  if params[:mode] == 'crd'
91
91
  render :template => 'questions/index_crd'
@@ -105,13 +105,13 @@ class QuestionsController < ApplicationController
105
105
  def show
106
106
  respond_to do |format|
107
107
  format.html # show.rhtml
108
- format.json { render :json => @answer.to_json }
108
+ format.json { render :json => @question }
109
109
  format.xml {
110
110
  if params[:mode] == 'crd'
111
111
  render :template => 'questions/show_crd'
112
112
  convert_charset
113
113
  else
114
- render :json => @question.to_xml
114
+ render :xml => @question
115
115
  end
116
116
  }
117
117
  end
@@ -122,7 +122,7 @@ class QuestionsController < ApplicationController
122
122
  @question = current_user.questions.new
123
123
  end
124
124
 
125
- # GET /questions/1;edit
125
+ # GET /questions/1/edit
126
126
  def edit
127
127
  end
128
128
 
@@ -135,10 +135,10 @@ class QuestionsController < ApplicationController
135
135
  if @question.save
136
136
  flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.question'))
137
137
  format.html { redirect_to @question }
138
- format.json { render :json => @question, :status => :created, :location => question_url(@question) }
138
+ format.json { render :json => @question, :status => :created, :location => @question }
139
139
  else
140
140
  format.html { render :action => "new" }
141
- format.json { render :json => @question.errors.to_json }
141
+ format.json { render :json => @question.errors, :status => :unprocessable_entity }
142
142
  end
143
143
  end
144
144
  end
@@ -150,10 +150,10 @@ class QuestionsController < ApplicationController
150
150
  if @question.update_attributes(params[:question])
151
151
  flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.question'))
152
152
  format.html { redirect_to @question }
153
- format.json { head :ok }
153
+ format.json { head :no_content }
154
154
  else
155
155
  format.html { render :action => "edit" }
156
- format.json { render :json => @question.errors.to_json }
156
+ format.json { render :json => @question.errors, :status => :unprocessable_entity }
157
157
  end
158
158
  end
159
159
  end
@@ -165,7 +165,7 @@ class QuestionsController < ApplicationController
165
165
 
166
166
  respond_to do |format|
167
167
  format.html { redirect_to user_questions_url(@question.user) }
168
- format.json { head :ok }
168
+ format.json { head :no_content }
169
169
  end
170
170
  end
171
171
  end
@@ -1,3 +1,3 @@
1
1
  module EnjuQuestion
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -64,9 +64,8 @@ class ApplicationController < ActionController::Base
64
64
  raise CanCan::AccessDenied
65
65
  end
66
66
 
67
- def get_user_if_nil
67
+ def get_user
68
68
  @user = User.where(:username => params[:user_id]).first if params[:user_id]
69
- #authorize! :show, @user if @user
70
69
  end
71
70
 
72
71
  def get_question
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_question
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-01 00:00:00.000000000 Z
12
+ date: 2012-03-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70157377252920 !ruby/object:Gem::Requirement
16
+ requirement: &70136439420460 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70157377252920
24
+ version_requirements: *70136439420460
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: simple_form
27
- requirement: &70157377252500 !ruby/object:Gem::Requirement
27
+ requirement: &70136439419500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70157377252500
35
+ version_requirements: *70136439419500
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sunspot_rails
38
- requirement: &70157377252040 !ruby/object:Gem::Requirement
38
+ requirement: &70136439417920 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70157377252040
46
+ version_requirements: *70136439417920
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sunspot_solr
49
- requirement: &70157377251620 !ruby/object:Gem::Requirement
49
+ requirement: &70136439417040 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70157377251620
57
+ version_requirements: *70136439417040
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: devise
60
- requirement: &70157377251200 !ruby/object:Gem::Requirement
60
+ requirement: &70136439415720 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70157377251200
68
+ version_requirements: *70136439415720
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cancan
71
- requirement: &70157377250780 !ruby/object:Gem::Requirement
71
+ requirement: &70136439414360 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70157377250780
79
+ version_requirements: *70136439414360
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: acts-as-taggable-on
82
- requirement: &70157377250280 !ruby/object:Gem::Requirement
82
+ requirement: &70136439412920 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '2.2'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70157377250280
90
+ version_requirements: *70136439412920
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: friendly_id
93
- requirement: &70157377249780 !ruby/object:Gem::Requirement
93
+ requirement: &70136439412200 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '4.0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70157377249780
101
+ version_requirements: *70136439412200
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: nokogiri
104
- requirement: &70157377249400 !ruby/object:Gem::Requirement
104
+ requirement: &70136439411600 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *70157377249400
112
+ version_requirements: *70136439411600
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: will_paginate
115
- requirement: &70157377265240 !ruby/object:Gem::Requirement
115
+ requirement: &70136439410820 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '3.0'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *70157377265240
123
+ version_requirements: *70136439410820
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: acts_as_list
126
- requirement: &70157377264740 !ruby/object:Gem::Requirement
126
+ requirement: &70136439410280 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 0.1.5
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *70157377264740
134
+ version_requirements: *70136439410280
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: enju_ndl
137
- requirement: &70157377264280 !ruby/object:Gem::Requirement
137
+ requirement: &70136439409760 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ~>
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: 0.0.12
143
143
  type: :runtime
144
144
  prerelease: false
145
- version_requirements: *70157377264280
145
+ version_requirements: *70136439409760
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: sqlite3
148
- requirement: &70157377263900 !ruby/object:Gem::Requirement
148
+ requirement: &70136439409320 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *70157377263900
156
+ version_requirements: *70136439409320
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: rspec-rails
159
- requirement: &70157377263440 !ruby/object:Gem::Requirement
159
+ requirement: &70136439408860 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,10 +164,10 @@ dependencies:
164
164
  version: '0'
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *70157377263440
167
+ version_requirements: *70136439408860
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: sunspot-rails-tester
170
- requirement: &70157377263020 !ruby/object:Gem::Requirement
170
+ requirement: &70136439408440 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - ! '>='
@@ -175,10 +175,10 @@ dependencies:
175
175
  version: '0'
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *70157377263020
178
+ version_requirements: *70136439408440
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: factory_girl_rails
181
- requirement: &70157377262520 !ruby/object:Gem::Requirement
181
+ requirement: &70136439407900 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
184
184
  - - ~>
@@ -186,10 +186,10 @@ dependencies:
186
186
  version: '1.7'
187
187
  type: :development
188
188
  prerelease: false
189
- version_requirements: *70157377262520
189
+ version_requirements: *70136439407900
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: vcr
192
- requirement: &70157377262020 !ruby/object:Gem::Requirement
192
+ requirement: &70136439407400 !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
195
  - - ~>
@@ -197,10 +197,10 @@ dependencies:
197
197
  version: 2.0.0.rc2
198
198
  type: :development
199
199
  prerelease: false
200
- version_requirements: *70157377262020
200
+ version_requirements: *70136439407400
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: fakeweb
203
- requirement: &70157377261640 !ruby/object:Gem::Requirement
203
+ requirement: &70136439407020 !ruby/object:Gem::Requirement
204
204
  none: false
205
205
  requirements:
206
206
  - - ! '>='
@@ -208,7 +208,7 @@ dependencies:
208
208
  version: '0'
209
209
  type: :development
210
210
  prerelease: false
211
- version_requirements: *70157377261640
211
+ version_requirements: *70136439407020
212
212
  description: Question and answer management for Next-L Enju
213
213
  email:
214
214
  - tanabe@mwr.mediacom.keio.ac.jp
@@ -454,3 +454,4 @@ test_files:
454
454
  - spec/support/controller_macros.rb
455
455
  - spec/support/devise.rb
456
456
  - spec/support/vcr.rb
457
+ has_rdoc: