1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-10 21:24:20 +01:00
fab-manager/app/controllers/social_bot_controller.rb

18 lines
592 B
Ruby
Raw Normal View History

2016-07-28 17:44:58 +02:00
class SocialBotController < ActionController::Base
def share
case request.original_fullpath
when /(=%2F|\/)projects(%2F|\/)([\-0-9a-z_]+)/
@project = Project.friendly.find("#{$3}")
render :project, status: :ok
when /(=%2F|\/)events(%2F|\/)([0-9]+)/
@event = Event.find("#{$3}".to_i)
render :event, status: :ok
when /(=%2F|\/)trainings(%2F|\/)([\-0-9a-z_]+)/
@training = Training.friendly.find("#{$3}")
render :training, status: :ok
2016-07-28 17:44:58 +02:00
else
puts "unknown bot request : #{request.original_url}"
end
end
end