fix deprecations

This commit is contained in:
Lee Lawlor 2014-08-01 18:07:55 -04:00
parent 0c758f6e40
commit 28bc4e18e5
8 changed files with 10 additions and 21 deletions

View File

@ -3,7 +3,7 @@ class AppsController < ApplicationController
def index
@menu = 'apps'
@title = 'Internet of Things Apps' if current_user.nil?
# @twitters = TwitterAccount.find(:all, :conditions => { :user_id => current_user.id }) if current_user
end
end

View File

@ -82,7 +82,7 @@ class ChannelsController < ApplicationController
# redirect home if wrong slug
redirect_to '/' and return if @channel.nil?
api_key = ApiKey.find(:first, :conditions => { :channel_id => @channel.id, :write_flag => 1 } )
api_key = ApiKey.where(channel_id: @channel.id, write_flag: 1).first
@post_url = "/update?key=#{api_key.api_key}"
# names of non-blank channel fields

View File

@ -231,13 +231,9 @@ class FeedController < ApplicationController
# create options hash
select_options = Feed.select_options(channel, params)
# get feed based on conditions
feeds = Feed.find(
:all,
:conditions => { :channel_id => channel.id, :created_at => get_date_range(params) },
:select => select_options,
:order => 'created_at desc'
)
# get feeds
feeds = Feed.where(channel_id: channel.id, created_at: get_date_range(params)).select(select_options).order('created_at desc')
@count = feeds.count
@time_after_db = Time.now

View File

@ -92,12 +92,7 @@ class StatusController < ApplicationController
# get most recent entry if necessary
params[:id] = @channel.last_entry_id if params[:id] == 'last'
@feed = @channel.feeds.find(
:first,
:conditions => { :entry_id => params[:id] },
:select => [:created_at, :entry_id, :status]
)
@feed = @channel.feeds.where(entry_id: params[:id]).select([:created_at, :entry_id, :status]).first
@success = channel_permission?(@channel, @api_key)
@ -110,7 +105,6 @@ class StatusController < ApplicationController
elsif request.format == 'csv'
@csv_headers = [:created_at, :entry_id, :status]
elsif (request.format == 'txt' or request.format == 'text')
output = add_prepend_append(@feed.status)
else
output = @feed.to_json
@ -119,7 +113,6 @@ class StatusController < ApplicationController
# else set error code
else
if request.format == 'xml'
output = bad_feed_xml
else
output = '-1'.to_json

View File

@ -371,7 +371,7 @@ class Channel < ActiveRecord::Base
tag.save
end
tagging = Tagging.find(:first, :conditions => { :tag_id => tag.id, :channel_id => self.id})
tagging = Tagging.where(tag_id: tag.id, channel_id: self.id).first
# save if new tagging
if tagging.nil?
tagging = Tagging.new
@ -392,7 +392,7 @@ class Channel < ActiveRecord::Base
tag_array = tag_array.collect {|t| t.strip }
# get all taggings for this channel
taggings = Tagging.find(:all, :conditions => { :channel_id => self.id }, :include => :tag)
taggings = Tagging.where(channel_id: self.id).includes(:tag)
# check for existence
taggings.each do |tagging|

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long