@read_reports = @issue.read_reports
@unread_reports = @issue.unread_reports
@comments = @issue.comments
+ @related_issues = @issue.user.issues
end
def new
unless create_new_issue_params.blank?
@issue = Issue.find_or_initialize_by(create_new_issue_params)
- puts params[:user_id].to_s + "--------------"
end
end
@report = @issue.reports.build(report_params)
@report.user_id = @user.id
if @issue.save!
- redirect_to root_path, notice: 'Issue was successfully created.'
+ redirect_to root_path, notice: 'Your report has been registered sucessfully.'
else
render :new
end
end
def create_new_issue_params
- params.permit(:reportable_id, :reportable_type, :user_id)
+ params.permit(:reportable_id, :reportable_type, :reported_user_id)
end
def issue_params
- params.permit(:reportable_id, :reportable_type,:user_id)
+ params[:issue].permit(:reportable_id, :reportable_type,:reported_user_id)
end
def report_params