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

View File

@ -82,7 +82,7 @@ class ChannelsController < ApplicationController
# redirect home if wrong slug # redirect home if wrong slug
redirect_to '/' and return if @channel.nil? 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}" @post_url = "/update?key=#{api_key.api_key}"
# names of non-blank channel fields # names of non-blank channel fields

View File

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

View File

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

View File

@ -371,7 +371,7 @@ class Channel < ActiveRecord::Base
tag.save tag.save
end 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 # save if new tagging
if tagging.nil? if tagging.nil?
tagging = Tagging.new tagging = Tagging.new
@ -392,7 +392,7 @@ class Channel < ActiveRecord::Base
tag_array = tag_array.collect {|t| t.strip } tag_array = tag_array.collect {|t| t.strip }
# get all taggings for this channel # 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 # check for existence
taggings.each do |tagging| 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