Commit 1bb333a8 authored by Andi Saurer's avatar Andi Saurer

add backward compatibility for rails 3.2

parent 469e79bc
......@@ -4,16 +4,24 @@ module ShortMessage
class MessagesController < ApplicationController
def status
unless params[:id].blank? or params[:status].blank?
if message = ShortMessage::Message.find_by(message_key: params[:id])
if message = ShortMessage::Message.where(message_key: params[:id]).first
message.status_code = params[:status]
message.save!
render plain: "Message #{params[:id]} has now status #{params[:status]}"
message = "Message #{params[:id]} has now status #{params[:status]}"
else
render plain: "Message #{params[:id]} not found!", status: 404
message = "Message #{params[:id]} not found!"
status = 404
end
else
render plain: "Message ID or status not provided!", status: 400
message = "Message ID or status not provided!"
status = 400
end
if Rails.version[0].to_i > 4
render plain: message, status: status
else
render text: message, status: status
end
end
end
......
module ShortMessage
VERSION = "1.0.0"
VERSION = "1.0.1"
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment