thingspeak/lib/api_keys.rb
2014-02-17 12:05:39 -05:00

12 lines
360 B
Ruby

module ApiKeys
def api_index (channel_id)
if current_user && !current_user.channels.find_by_id(channel_id).nil?
@channel = current_user.channels.find(channel_id)
end
if current_user && current_user.id == @channel.user_id
@write_key = @channel.api_keys.write_keys.first
@read_keys = @channel.api_keys.read_keys
end
end
end