end
# Add any text filter
- @notes = @notes.joins(:comments).where("to_tsvector('english', note_comments.body) @@ plainto_tsquery('english', ?)", params[:q]) if params[:q]
+ if params[:q]
+ @notes = @notes.joins(:comments).where("to_tsvector('english', note_comments.body) @@ plainto_tsquery('english', ?) OR to_tsvector('english', notes.description) @@ plainto_tsquery('english', ?)", params[:q], params[:q])
+ end
# Add any date filter
if params[:from]
##
# Get author's information (for logged in users - user_id, for logged out users - IP address)
def author_info
- if scope_enabled?(:write_notes)
+ if current_user
{ :user_id => current_user.id }
else
{ :user_ip => request.remote_ip }