Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix redirect login loop

  • Loading branch information...
commit 7deb30a94413741c188b0b6258e6ec358fa96670 1 parent e416429
@rwdaigle authored
View
2  app/controllers/sessions_controller.rb
@@ -13,6 +13,6 @@ def create
user = User.authenticate(request.env['omniauth.auth'])
log_in_user(user.id)
redirect_to search_gists_path
- log({ns: self, fn: __method__, measure: true, at: 'login'}, user)
+ log({ns: self.class, fn: __method__, measure: true, at: 'login'}, user)
end
end
View
19 app/models/gist.rb
@@ -48,16 +48,19 @@ def import(gh_gist)
end
def search(user, q)
- q = q.blank? ? '*' : q
log({ns: self, fn: __method__, query: q, measure: true, at: 'search'}, user)
- log({ns: self, fn: __method__, query: q, measure: true}, user) do
- tire.search do
- query { string q }
- sort { by :gh_created_at, 'desc' }
- filter :term, :user_id => user.id
- highlight :description, :'files.content'
- size 15
+ if(!q.blank?)
+ log({ns: self, fn: __method__, query: q, measure: true}, user) do
+ tire.search do
+ query { string q }
+ sort { by :gh_created_at, 'desc' }
+ filter :term, :user_id => user.id
+ highlight :description, :'files.content'
+ size 15
+ end
end
+ else
+ []
end
end
View
2  app/views/gists/search.html.haml
@@ -3,7 +3,7 @@
= label_tag(:q, "Search your gists:")
= text_field_tag(:q, params[:q])
= submit_tag("Go")
- = "(last updated: #{current_user.last_gh_fetch.to_formatted_s(:short)})"
+ = "(last updated: #{current_user.last_gh_fetch ? current_user.last_gh_fetch.to_formatted_s(:short) : "not yet"})"
%ul
- for result in @results
Please sign in to comment.
Something went wrong with that request. Please try again.