Skip to content

Commit

Permalink
test app on production
Browse files Browse the repository at this point in the history
  • Loading branch information
upans committed Aug 3, 2018
1 parent d1f12c2 commit b468aec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/controllers/tiny_urls_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def get_orginal_url
#begin
path_after_base_url = request.original_fullpath
@tiny_url = TinyUrl.get_tiny_url_by_path(path_after_base_url)
@tiny_url.set_last_hit
redirect_to @tiny_url.orginal_url
# rescue Exception => e
# flash[:danger] = "Somthing wrong! Url not found"
Expand Down
3 changes: 1 addition & 2 deletions app/models/tiny_url.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
class TinyUrl < ApplicationRecord
include Decodable
validates :orginal_url, :format => URI::regexp(%w(http https))
after_find :add_last_hit
after_create :set_decode_url

def add_last_hit
def set_last_hit
self.last_hit = Time.now.strftime("%d/%m/%Y %H:%M")
self.save
end
Expand Down

0 comments on commit b468aec

Please sign in to comment.