Permalink
Browse files

Fix redirect login loop

  • Loading branch information...
1 parent e416429 commit 7deb30a94413741c188b0b6258e6ec358fa96670 @rwdaigle committed Oct 6, 2012
Showing with 13 additions and 10 deletions.
  1. +1 −1 app/controllers/sessions_controller.rb
  2. +11 −8 app/models/gist.rb
  3. +1 −1 app/views/gists/search.html.haml
@@ -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
@@ -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
@@ -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

0 comments on commit 7deb30a

Please sign in to comment.