ruby on rails - Heroku errors [was working yesterday] -
i keep getting these error's in heroku logs every time i've tried deploy today. app working fine last night, i'm not sure what's changed since since haven't done new.
song_controller.rb
class songscontroller < applicationcontroller before_filter :authenticate_user!, only: [:create ,:edit, :update, :destroy, :vote_for_song] before_action :set_song, only: [:show, :edit, :update, :destroy, :vote_for_song] def extract_video @song = song.find(params[:id]) @song.youtubeaddy.extract_video_id end def vote_for @song = song.find(params[:id]) current_user.vote_for(@song) @song.plusminus = @song.votes_for @song.save respond_to |format| format.js { render 'update_votes' } end end def vote_against @song = song.find(params[:id]) current_user.vote_against(@song) respond_to |format| format.js { render 'update_votes' } end end def new_songs @songs = song.order("id desc").paginate(:page => params[:page], :per_page => 15) get_last_song end # /songs # /songs.json def index if params[:query].present? @songs = song.search(params) get_last_song elsif params[:genre] @songs = song.tagged_with(params[:genre]).paginate(:page => params[:page], :per_page => 15) get_last_song else @songs = song.order('id').order('plusminus desc nulls last').paginate(:page => params[:page], :per_page => 15) #@songs = song.tally.paginate(:page => params[:page], :per_page => 15) get_last_song end end def get_last_song if params[:page].nil? @last_song = 0 else @last_song = 15 * (params[:page].to_i - 1) end end # /songs/1 # /songs/1.json def show @comment = comment.new(song: @song) @video_tag = youtubeaddy.extract_video_id(@song.url) end # /songs/new def new @song = song.new end # /songs/1/edit def edit end # post /songs # post /songs.json def create @song = song.new(song_params) respond_to |format| if @song.save format.html { redirect_to @song, notice: 'song created.' } format.json { render action: 'show', status: :created, location: @song } else format.html { render action: 'new' } format.json { render json: @song.errors, status: :unprocessable_entity } end end end # patch/put /songs/1 # patch/put /songs/1.json def update respond_to |format| if @song.update(song_params) format.html { redirect_to @song, notice: 'song updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @song.errors, status: :unprocessable_entity } end end end # song /songs/1 # song /songs/1.json def destroy @song.destroy respond_to |format| format.html { redirect_to songs_url } format.json { head :no_content } end end private def set_song @song = song.find(params[:id]) end def song_params params.require(:song).permit(:title, :artist, :url, :track, :user_id, :tag_list, :query, :genre, :page) end end
song.rb
class song < activerecord::base acts_as_voteable index_name bonsai_index_name belongs_to :user has_many :comments, :dependent => :destroy has_many :genre_songs has_many :genres, through: :genre_songs has_attached_file :track # :url => "/assets/songs/:id/:style/:basename.:extension", # :path => ":rails_root/public/assets/songs/:id/:style/:basename.:extension" # validates_attachment :track, :presence => true validates_presence_of :url validates :title, length: { minimum: 10 } validates :url, length: { maximum: 300 } validates :url, :format => uri::regexp(%w(http https)) include tire::model::search include tire::model::callbacks def self.search(params) tire.search(load: true, page: params[:page], per_page: 15) query { string params[:query], default_operator: "and" } if params[:query].present? end end def to_indexed_json to_json(methods: [:genre_names]) end def genre_names genres.map{ |g| g.name} end def self.tagged_with(name) genre.find_by_name!(name).songs end def tag_list genres.map(&:name).join(", ") end def tag_list=(names) self.genres = names.split(",").map |n| genre.where(name: n.strip).first_or_create! end end end
heroku error:
2013-08-07t19:15:49.605667+00:00 app[web.1]: errno::econnrefused (connection refused - connect(2)): 2013-08-07t19:15:49.605667+00:00 app[web.1]: f, [2013-08-07t19:15:49.604633 #2] fatal -- : 2013-08-07t19:15:49.605667+00:00 app[web.1]: app/controllers/songs_controller.rb:83:in `block in create' 2013-08-07t19:15:49.605667+00:00 app[web.1]: 2013-08-07t19:15:49.605667+00:00 app[web.1]: app/controllers/songs_controller.rb:82:in `create' 2013-08-07t19:15:49.605667+00:00 app[web.1]: 2013-08-07t19:15:49.620779+00:00 heroku[router]: at=info method=post path=/songs host=www.leapfm.com fwd="99.233.170.104" dyno=web.1 connect=7ms service=110ms status=500 bytes=1266 7 19:17:41 +0000 2013-08-07t19:17:41.781821+00:00 app[web.1]: f, [2013-08-07t19:17:41.781602 #2] fatal -- : 2013-08-07t19:17:41.781821+00:00 app[web.1]: 2013-08-07t19:17:41.781821+00:00 app[web.1]: 2013-08-07t19:17:41.781821+00:00 app[web.1]: f, [2013-08-07t19:17:41.781666 #2] fatal -- : 2013-08-07t19:17:41.768371+00:00 app[web.1]: i, [2013-08-07t19:17:41.768179 #2] info -- : started "/songs/24" 72.5.89.102 @ 2013-08-07 19:17:41 +0000 2013-08-07t19:17:41.781821+00:00 app[web.1]: activerecord::recordnotfound (couldn't find song id=24): 2013-08-07t19:17:41.781821+00:00 app[web.1]: app/controllers/songs_controller.rb:120:in `set_song' 2013-08-07t19:17:41.781821+00:00 app[web.1]: activerecord::recordnotfound (couldn't find song id=24): 2013-08-07t19:17:41.781821+00:00 app[web.1]: app/controllers/songs_controller.rb:120:in `set_song' 2013-08-07t19:17:41.781821+00:00 app[web.1]: 2013-08-07t19:17:41.781821+00:00 app[web.1]: 07t19:17:51.527635+00:00 app[web.1]: activerecord::recordnotfound (couldn't find song id=22): 2013-08-07t19:17:51.527635+00:00 app[web.1]: 2013-08-07t19:17:51.527635+00:00 app[web.1]: activerecord::recordnotfound (couldn't find song id=22): 2013-08-07t19:17:51.527635+00:00 app[web.1]: app/controllers/songs_controller.rb:120:in `set_song' 2013-08-07t19:17:51.527635+00:00 app[web.1]: app/controllers/songs_controller.rb:120:in `set_song' 2013-08-07t19:21:16.681196+00:00 app[web.1]: app/models/song.rb:28:in `search' 2013-08-07t19:21:16.670635+00:00 app[web.1]: i, [2013-08-07t19:21:16.670450 #2] info -- : started "/songs?utf8=%e2%9c%93&query=rap" 99.233.170.104 @ 2013-08-07 19:21:16 +0000 2013-08-07t19:21:16.681196+00:00 app[web.1]: errno::econnrefused (connection refused - connect(2)): 2013-08-07t19:21:16.681196+00:00 app[web.1]: f, [2013-08-07t19:21:16.680957 #2] fatal -- : 2013-08-07t19:21:16.681196+00:00 app[web.1]: app/controllers/songs_controller.rb:40:in `index' 2013-08-07t19:21:16.681196+00:00 app[web.1]: app/models/song.rb:28:in `search' 2013-08-07t19:21:16.681196+00:00 app[web.1]: 2013-08-07t19:21:16.681196+00:00 app[web.1]: f, [2013-08-07t19:21:16.681232 #2] fatal -- : 2013-08-07t19:21:16.670635+00:00 app[web.1]: i, [2013-08-07t19:21:16.670529 #2] info -- : started "/songs?utf8=%e2%9c%93&query=rap" 99.233.170.104 @ 2013-08-07 19:21:16 +0000 2013-08-07t19:21:16.681196+00:00 app[web.1]: errno::econnrefused (connection refused - connect(2)): 2013-08-07t19:21:16.681558+00:00 app[web.1]: 2013-08-07t19:21:16.681196+00:00 app[web.1]: 2013-08-07t19:21:16.681196+00:00 app[web.1]: app/controllers/songs_controller.rb:40:in `index' 2013-08-07t19:21:16.681558+00:00 app[web.1]: 2013-08-07t19:21:16.682976+00:00 heroku[router]: at=info method=get path=/songs? 2013-08-07t19:21:32.687381+00:00 app[web.1]: errno::econnrefused (connection refused - connect(2)): 2013-08-07t19:21:32.687381+00:00 app[web.1]: app/controllers/songs_controller.rb:83:in `block in create' 2013-08-07t19:21:32.687381+00:00 app[web.1]: app/controllers/songs_controller.rb:82:in `create' 2013-08-07t19:21:32.687381+00:00 app[web.1]: f, [2013-08-07t19:21:32.687331 #2] fatal -- : 2013-08-07t19:21:32.694312+00:00 heroku[router]: at=info method=post path=/songs host=www.leapfm.com fwd="99.233.170.104" dyno=web.1 connect=3ms service=35ms status=500 bytes=1266 2013-08-07t19:21:32.687381+00:00 app[web.1]: errno::econnrefused (connection refused - connect(2)): 2013-08-07t19:21:32.687381+00:00 app[web.1]: app/controllers/songs_controller.rb:82:in `create' 2013-08-07t19:21:32.687381+00:00 app[web.1]: 2013-08-07t19:21:32.687594+00:00 app[web.1]: 2013-08-07t19:21:32.687594+00:00 app[web.1]: 2013-08-07t19:21:32.687381+00:00 app[web.1]: app/controllers/songs_controller.rb:83:in `block in create'
bonsai.rb
if env['bonsai_index_url'] tire.configure url "http://kpphwqlo:tsbest4n4cpwd2ou@holly-7515324.us-east-1.bonsai.io" end bonsai_index_name = env['bonsai_url'][/[^\/]+$/] else app_name = rails.application.class.parent_name.underscore.dasherize bonsai_index_name = "#{app_name}-#{rails.env}" end
check if have variable on heroku.
if env['bonsai_index_url']
this check if variable exists , if not set:
bonsai_index_name = "#{app_name}-#{rails.env}"
that give wrong elastic search connection.
Comments
Post a Comment