Skip to content

Commit 4f47a7e

Browse files
committed
fixed article rating due to scope change
1 parent 7989478 commit 4f47a7e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/controllers/articles_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class ArticlesController < KnowledgebaseController
88
before_filter :get_article, :only => [:add_attachment, :show, :edit, :update, :add_comment, :destroy, :destroy_comment]
99

1010
def find_project
11+
# TODO refactor
1112
if !params[:project_id].nil?
1213
@project=Project.find(params[:project_id])
1314
elsif !params[:category_id].nil?
@@ -21,12 +22,13 @@ def find_project
2122

2223
def new
2324
@article = KbArticle.new
24-
@categories=@project.categories.find(:all)
25+
@categories = @project.categories.find(:all)
2526
@default_category = params[:category_id]
2627
@article.category_id = params[:category_id]
2728
end
2829

2930
def rate
31+
binding.pry
3032
@article = KbArticle.find(params[:id])
3133
rating = params[:rating].to_i
3234
@article.rate rating if rating > 0

app/views/articles/_rating.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $(function(){
1212
callback: function(value, link) {
1313
$.ajax({
1414
type: "POST",
15-
url: "<%= rate_article_url(@article) %>",
15+
url: "<%= rate_article_url(@project, @article) %>",
1616
data: {
1717
rating: value
1818
}

0 commit comments

Comments
 (0)