Deliver later not working in the test environment in Rails 5 Posted: 24 Sep 2016 07:45 AM PDT Basically, with the test config set up exactly how it worked in Rails 4 (delivery method set as test etc), aside from deprecated options which I have replaced, mail only sends with deliver_now, not deliver_later. Deliver_later works in the development environment, even when the config is identical between the two environments. Test environment mailer config: config.action_mailer.delivery_method = :test config.action_mailer.perform_deliveries = true config.action_mailer.perform_caching = false config.action_mailer.raise_delivery_errors = true config.action_mailer.default_url_options = { :host => 'localhost:3000' } |
Rails 4 Error: NoMethodError - undefined method `itemfavorites' Posted: 24 Sep 2016 07:49 AM PDT Hey I am receiving an issue when accessing @interestedusers = User.itemfavorites.where(item_id: @item.id) from my ItemsController : NoMethodError in ItemsController#show undefined method `itemfavorites' for #<Class:0xfb94bb8> Routes resources :items do get :itemfavorites, on: :member end User Model # Favorite items of user has_many :favorite_items # just the 'relationships' has_many :itemfavorites, through: :favorite_item, source: :item # the actual items the user favorites Item Model # Favorited by users has_many :favorite_items # just the 'relationships' has_many :itemsfavorited_by, through: :favorite_items, source: :user # the actual users favoriting an item The general association works, I tested it and I can add/remove and display favorites.
I am trying to display the users favorited an Item. Thanks in advance for each answer! Please tell me if you need additional information. |
Filter with association : SQL error no such column Posted: 24 Sep 2016 08:00 AM PDT I m trying to implant filter after query. I have 2 models with association 1) Camping 2)Caracteristiquetest. Modele Caracteristiquetest have camping_id. Query works but when i m trying to apply filter with checkbox i have an error. I think it's an association problem. How I can fix that ? Thanks for your help. SQLite3::SQLException: no such column: handicap: SELECT "campings".* FROM "campings" WHERE (piscine LIKE '%%' AND barbecue LIKE '%%' AND nomdep LIKE '%aube%' AND handicap LIKE '%oui%') MODEL Camping.rb scope :handicap, -> (handicap) { where handicap: "oui" } belongs_to :caracteristiquetest def self.search(piscine, barbecue, nomdep, handicap) return scoped unless piscine.present? || barbecue.present? || nomdep.present? || handicap.present? where(['piscine LIKE ? AND barbecue LIKE ? AND nomdep LIKE ? AND handicap LIKE ?', "%#{piscine}%", "%#{barbecue}%", "%#{nomdep}%", "%#{handicap}%"]) end Caracteristiquetst.rb has_one :camping CONTROLLER camping_controller.rb def resultnohome if params[:piscine] && params[:barbecue] && params[:nomdep] && params[:handicap].blank? redirect_to action: :index and return else @campings = Camping.search(params[:piscine], params[:barbecue], params[:nomdep], params[:handicap]) end end VIEW _searchfilter.html.erb <%= text_field_tag :nomdep, params[:nomdep], class:"SearchFilter", placeholder:"Ex : Vendée, Corse..." %> <li><p><span class="IcoSwim" aria-hidden="true"></span> Piscine : <%= check_box_tag :piscine, "oui", !!params[:piscine], :class => "piscine" %></p></li> <li><p><span class="IcoSlide" aria-hidden="true"></span>Toboggan aquatique </p></li> <li><p><span class="glyphicon glyphicon-fire" aria-hidden="true"></span> Barbecue : <%= check_box_tag :barbecue, "oui", !!params[:barbecue], :class => "barbecue" %></p></li> <li><p><span class="IcoHandi" aria-hidden="true"></span> Accès handicapé : <%= check_box_tag :handicap, "oui", !!params[:handicap], :class => "handicap" %></p></li> <%= submit_tag "Appliquer les filtres", class:"btn btn-danger2", name: nil %> |
Jquery Datepicker with Ruby on Rails does not work Posted: 24 Sep 2016 06:57 AM PDT I want to use the jquery datepicker for my Ruby on Rails Application. I have done everything like in this railscasts calendar tutorial (link :https://www.youtube.com/watch?v=ndBKSjAbemo), but it just does not work. My textfield is still a normal text_field and no calendar pops up. gemfiles: gem 'jquery-ui-rails', '~> 4.2.1' PS: I have even downgraded the version, but it is still not working In application.js: //= require turbolinks //= require jquery //= require jquery_ujs //= require jquery.ui.datepicker //= require_tree application.css: *= require jquery.ui.datepicker *= require_tree . *= require_self bikes.js: jQuery -> $('#bike_available_from').datepicker(dateFormat: 'dd-mm-yy') bike.new.view: <%= f.text_field :available_from %> |
WebRTC Error: Failed to create remote session description. Called in wrong state Posted: 24 Sep 2016 06:47 AM PDT I am trying to implement a real time audio/video group calls, but for now I want to get it for only two participants. It is not working and I don't understand why :( (actually when I test it with myself with two different accounts at the same time, I see some error messages but it works anyway, but when I test it with a friend in real different networks, the same error messages appear but in this case we can not hear or see each other). I am using Chrome 53 on Linux (Ubuntu 16.04). The error messages are the following, for the peer who sends the offer there are 6 errors in the browser console. 1st: Failed to create remote session description: OperationError: Failed to set remote offer sdp: Called in wrong state: STATE_SENTOFFER 2nd, 3rd, 4th, and 5th: addIceCandidate error: OperationError: Error processing ICE candidate 6th: Failed to set local session description: OperationError: CreateAnswer failed because remote_description is not an offer And for the peer who receives the offer and sends and answer there is 1 error in the browser console: Failed to create remote session description: OperationError: Failed to set remote answer sdp: Called in wrong state: STATE_INPROGRESS In case you want to see all the messages in the console, the ones in the peer who sends the offer are here: WebRTC error from offer peer. And the ones in the other peer browser console are here: WebRTC error from answer peer. The code that matters in the the HTML file is the following (there are other files with Javascript code that I will show later): <div class='row'> <div class='col-xs'> <div class='box center-xs middle xs'> <h1>Call CallNameExample</h1> </div> </div> </div> <div class='row'> <div class='col-xs'> <div class='box center-content'> <button class='btn btn-info btn-37 no-padding circle' id='btnChangeCamStatus'> <i class='material-icons' id='iconCamOff'> videocam_off </i> <i class='material-icons hidden' id='iconCamOn'> videocam </i> </button> <button class='btn btn-info btn-37 no-padding circle' id='btnChangeMicStatus'> <i aria-hidden='true' class='fa fa-microphone-slash' id='iconMicOff'></i> <i aria-hidden='true' class='fa fa-microphone hidden' id='iconMicOn'></i> </button> </div> </div> </div> <div class='row'> <div class='col-xs'> <div class='box center-xs middle xs'> <video autoplay height='200px' id='bigRemoteVideo' width='200px'></video> </div> </div> </div> <script> var room = "1" var localVideo = document.getElementById("localVideo") var bigRemoteVideo = document.getElementById("bigRemoteVideo") document.getElementById("btnChangeCamStatus").addEventListener("click", function() { if (localStream.getVideoTracks()[0].enabled) { disableCam() $("#iconCamOff").addClass("hidden") $("#iconCamOn").removeClass("hidden") } else { enableCam() $("#iconCamOff").removeClass("hidden") $("#iconCamOn").addClass("hidden") } }, false); document.getElementById("btnChangeMicStatus").addEventListener("click", function() { if (localStream.getAudioTracks()[0].enabled) { disableMic() $("#iconMicOff").addClass("hidden") $("#iconMicOn").removeClass("hidden") } else { enableMic() $("#iconMicOff").removeClass("hidden") $("#iconMicOn").addClass("hidden") } }, false); function setLocalVideo(stream) { localVideo.src = window.URL.createObjectURL(stream) } function setRemoteVideo(stream) { bigRemoteVideo.src = window.URL.createObjectURL(stream) } localVideo.addEventListener('loadedmetadata', function() { console.log('Local video videoWidth: ' + this.videoWidth + 'px, videoHeight: ' + this.videoHeight + 'px'); }); bigRemoteVideo.addEventListener('loadedmetadata', function() { console.log('Remote video videoWidth: ' + this.videoWidth + 'px, videoHeight: ' + this.videoHeight + 'px'); }); // Starts the party: (function(){ enableUserMedia() window.createOrJoin(room) console.log("Attempted to create or join room: " + room) }()) </script> The other Javascript files contain the next code (all the files together here): var localStream var mediaConstraints = {video: true, audio: true} function enableUserMedia(){ console.log('Getting user media with constraints', mediaConstraints); navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia if (navigator.getUserMedia) { navigator.getUserMedia(mediaConstraints, gotStream, gotError) } window.URL = window.URL || window.webkitURL function gotStream(stream) { console.log('Adding local stream.'); setLocalVideo(stream) localStream = stream; //sendMessage('got user media'); console.log('got user media'); attachLocalMedia(); } function gotError(error) { console.log("navigator.getUserMedia error: ", error); } } function disableCam(){ localStream.getVideoTracks()[0].enabled = false } function disableMic(){ localStream.getAudioTracks()[0].enabled = false } function enableCam(){ localStream.getVideoTracks()[0].enabled = true } function enableMic(){ localStream.getAudioTracks()[0].enabled = true } function disableUserMedia(){ localStream.getVideoTracks()[0].stop(); localStream.getAudioTracks()[0].stop(); } window.onbeforeunload = function() { sendMessage("bye"); }; function hangup() { console.log("Hanging up."); stop(); sendMessage("bye"); } function handleRemoteHangup() { console.log("Session terminated."); stop(); } function stop() { disableUserMedia(); pc.close(); console.log("PC STATE: " + pc.signalingState || pc.readyState); console.log("PC ICE STATE: " + pc.iceConnectionState) pc = null; } var isInitiator = false var justJoinedRoom = false var sdpConstraints = { // Set up audio and video regardless of what devices are present. 'mandatory': { 'OfferToReceiveAudio': true, 'OfferToReceiveVideo': true } } function sendMessage(message){ App.call.message(message); } function doCall() { console.log("Sending offer to peer"); pc.createOffer(sdpConstraints) .then(setLocalAndSendMessage) .catch(handleCreateOfferError); //pc.createOffer(setLocalAndSendMessage, handleCreateOfferError); } function doAnswer() { console.log("Sending answer to peer."); pc.createAnswer() .then(setLocalAndSendMessage) .catch(onSetLocalSessionDescriptionError); } function setLocalAndSendMessage(sessionDescription) { console.log("setLocalAndSendMessage sending message" + JSON.stringify(sessionDescription)); pc.setLocalDescription(sessionDescription) .then( function(){ onSetLocalSuccess(); sendMessage(sessionDescription); } ) .catch(onSetLocalSessionDescriptionError); } function onSetLocalSuccess() { console.log('setLocalDescription complete'); } function onSetRemoteSuccess() { console.log('setRemoteDescription complete'); doAnswer(); } function onSetLocalSessionDescriptionError(error) { console.error('Failed to set local session description: ' + error.toString()) } function handleCreateOfferError(event) { console.error("createOffer() error: " + JSON.stringify(event)) } function onSetRemoteSessionDescriptionError(error) { console.error("Failed to create remote session description: " + error.toString()) } function handleReceivedOffer(message) { console.log("handleReceivedOffer: " + JSON.stringify(message)); pc.setRemoteDescription(new RTCSessionDescription(message)) .then(onSetRemoteSuccess) .catch(onSetRemoteSessionDescriptionError) } function handleReceivedAnswer(message) { console.log("handleReceivedAnswer: " + JSON.stringify(message)); pc.setRemoteDescription(new RTCSessionDescription(message)) .then(onSetRemoteSuccess) .catch(onSetRemoteSessionDescriptionError) } function handleReceivedCandidate(label, candidate) { pc.addIceCandidate( new RTCIceCandidate({ sdpMLineIndex: label, candidate: candidate }) ).then(successAddingIceCandidate).catch(errorAddingIceCandidate) } function successAddingIceCandidate() { console.log("addIceCandidate successfully") } function errorAddingIceCandidate(error) { console.error("addIceCandidate error: " + error.toString()) } var remoteStream var pc var pcConfig = { 'iceServers': [{ 'url': 'stun:stun.l.google.com:19302' }, { 'url': 'turn:192.158.29.39:3478?transport=udp', 'credential': 'JZEOEt2V3Qb0y27GRntt2u2PAYA=', 'username': '28224511:1379330808' }] } function connectionStateCallback(){ var state; if (pc) { state = pc.connectionState console.log("PC CONNECTION state change callback, state: " + state) } } function signalingStateCallback() { var state; if (pc) { state = pc.signalingState || pc.readyState; console.log("PC SIGNALING state change callback, state: " + state); } } function iceStateCallback() { var iceState; if (pc) { iceState = pc.iceConnectionState; console.log('PC ICE connection state change callback, state: ' + iceState); } } function createPeerConnection() { try { pc = new RTCPeerConnection(pcConfig); signalingStateCallback(); pc.onsignalingstatechange = signalingStateCallback; console.log("PC ICE STATE: " + pc.iceConnectionState); pc.oniceconnectionstatechange = iceStateCallback; pc.onconnectionstatechange = connectionStateCallback; pc.onicecandidate = handleIceCandidate; pc.onaddstream = handleRemoteStreamAdded; pc.onremovestream = handleRemoteStreamRemoved; console.log('Created RTCPeerConnnection'); attachLocalMedia(); } catch (e) { console.error("Failed to create PeerConnection, exception: " + e.toString()) return; } } function handleIceCandidate(event) { console.log("icecandidate event: " + JSON.stringify(event)); if (event.candidate) { sendMessage({ type: "candidate", label: event.candidate.sdpMLineIndex, id: event.candidate.sdpMid, candidate: event.candidate.candidate }); } else { console.log("End of candidates."); } } function handleRemoteStreamAdded(event) { console.log("Remote stream added."); setRemoteVideo(event.stream); remoteStream = event.stream; } function handleRemoteStreamRemoved(event) { //In real life something should be done here but since the point of this website is to learn, this function is not a priority right now. console.log("Remote stream removed. Event: " + event); } function attachLocalMedia() { if (pc && localStream) { pc.addStream(localStream) console.log("Added localStream to pc") if (justJoinedRoom) { console.log("call to DOCALL() from attachLocalMedia()") doCall() } } } And finally the code related to the signaling. But first I want to clarify I am doing this website with Rails 5 and the signaling with WebSockets via ActionCable, so the CoffeeScript file (the client side) for the channel is this one: window.createOrJoin = (roomID) -> App.call = App.cable.subscriptions.create { channel: "CallChannel", room: roomID }, connected: -> # Called when the subscription is ready for use on the server createPeerConnection() disconnected: -> # Called when the subscription has been terminated by the server received: (data) -> # Called when there's incoming data on the websocket for this channel if (data["kindOfData"] == "created") console.log('Created room ' + data["room"]) window.isInitiator = true # ESTO ME SIRVE SOLO PARA 2 PERSONAS!! # CREO QUE YA NI LO USO attachLocalMedia() else if (data["kindOfData"] == "full") console.log('Room ' + data["room"] + ' is full') else if (data["kindOfData"] == "join") console.log('Another peer made a request to join room ' + data["room"]) console.log('This peer is the initiator of room ' + data["room"] + '!') window.justJoinedRoom = false else if (data["kindOfData"] == "joined") console.log('joined: ' + data["room"]) window.justJoinedRoom = true attachLocalMedia() else if (data["kindOfData"] == "log") console.log(data["info"]) else if (data["kindOfData"] == "message") # This client receives a message console.log("Client received message: " + JSON.stringify(data["message"])); if (data["message"] == "bye") handleRemoteHangup() else if (data["message"]["type"] == "offer") handleReceivedOffer(data["message"]) # obj with "type" and "sdp" else if (data["message"]["type"] == "answer") handleReceivedAnswer(data["message"]) # obj with "type" and "sdp" else if (data["message"]["type"] == "candidate") handleReceivedCandidate(data["message"]["label"], data["message"]["candidate"]) message: (data) -> console.log("Client sending message: " + JSON.stringify(data)); @perform "message", {message: data, room: roomID} And the Ruby one (the server side): class CallChannel < ApplicationCable::Channel def subscribed # Action automatically called when a client is subscribed to the channel stream_from "calls" # calls is a channel in common for everyone # ONLY FOR TESTING!!! stream_from "calls_room#{params[:room]}_person#{current_user.id}" @@hashUsersByRoom ||= Hash.new() # { |h,k| h[k] = Set.new } @@hashRoomsByUser ||= Hash.new() # { |h,k| h[k] = Set.new } result = createOrJoin(params[:room]) end def unsubscribed # Any cleanup needed when channel is unsubscribed end def message(data) if data["message"].eql? "bye" if @@hashUsersByRoom[ data["room"] ] && @@hashUsersByRoom[ data["room"] ].include?( current_user.id ) @@hashUsersByRoom[ data["room"] ].delete( current_user.id ) if @@hashUsersByRoom[ data["room"] ].length() == 0 @@hashUsersByRoom.delete( data["room"] ) Call.find( data["room"] ).update_column("active", false) end end if @@hashRoomsByUser[ current_user.id ] && @@hashRoomsByUser[ current_user.id ].include?( data["room"] ) @@hashRoomsByUser[ current_user.id ].delete( data["room"] ) if @@hashRoomsByUser[ current_user.id ].length() == 0 @@hashRoomsByUser.delete( current_user.id ) end end end ActionCable.server.broadcast "calls_room#{data["room"]}", kindOfData: "log", info: "Client #{current_user.id} said: #{data["message"]}" ActionCable.server.broadcast "calls_room#{data["room"]}", kindOfData: "message", message: data["message"] end private def createOrJoin(room) ActionCable.server.broadcast "calls", kindOfData: "log", info: "Received request to create or join room #{room}" @@hashUsersByRoom[room] ||= Set.new() ActionCable.server.broadcast "calls", kindOfData: "log", info: "Room #{room} now has #{@@hashUsersByRoom[room].length()} + client(s)" if @@hashUsersByRoom[room].length == 0 stream_from "calls_room#{room}" # Join the room @@hashUsersByRoom[ room ] << current_user.id @@hashRoomsByUser[ current_user.id ] ||= Set.new() @@hashRoomsByUser[ current_user.id ] << room ActionCable.server.broadcast "calls", kindOfData: "log", info: "Client ID #{current_user.id} created room #{room}" ActionCable.server.broadcast "calls_room#{room}_person#{current_user.id}", kindOfData: "created", room: room, user: current_user.id Call.find(room).update_column("active", true) elsif ( @@hashUsersByRoom[room].length() < Call.where(:id => room).pluck(:maximumNumberOfParticipants)[0] ) || ( @@hashUsersByRoom[ data["room"] ].include?( current_user.id ) ) ActionCable.server.broadcast "calls", kindOfData: "log", info: "Client ID #{current_user.id} joined room #{room}" ActionCable.server.broadcast "calls_room#{room}", kindOfData: "join", room: room stream_from "calls_room#{room}" # Join the room @@hashUsersByRoom[ room ] << current_user.id @@hashRoomsByUser[ current_user.id ] ||= Set.new() @@hashRoomsByUser[ current_user.id ] << room ActionCable.server.broadcast "calls_room#{room}_person#{current_user.id}", kindOfData: "joined", room: room, user: current_user.id ActionCable.server.broadcast "calls_room#{room}", kindOfData: "ready" else # full room ActionCable.server.broadcast "calls_room#{room}_person#{current_user.id}", kindOfData: "full", room: room end end end Searching on the Internet I saw people with similar problems but each one was for a different reason and none of them was useful for my situation, but I saw somewhere that "STATE_INPROGRESS" means "Offer/answer exchange completed" so from that I can't understand if the offer/answer exchange was completed... why it is not working when I try to use it with a friend? and why is it trying to set more remote session descriptions in that case (when the offer/answer exchange is supposed to be completed)? So basically my main question is: what is going on and how can I solve it? If you reached this part of the question, thank you, I appreciate it! :) |
Can't use Mechanize to parse the website after deploy to Linode Posted: 24 Sep 2016 06:26 AM PDT |
How to persist Jquery UI droppable section in rails? Posted: 24 Sep 2016 05:36 AM PDT I am using ajax each time when an element is dropped like below. $.ajax({ method: 'PATCH', url: '/dropers/change', dataType: 'script', data: { droper: { factor_1: $droppable.attr('data-factor-1'), factor_2: $droppable.attr('data-factor-2') } } }); and save the data-factor attributes to database. How can i show it in the same position after when a page reloads? IMAGE - An example of my table |
How to use select....as and concat in rails 5 Posted: 24 Sep 2016 06:25 AM PDT I have a table called Student, the student table contains the id, first_name and last_name. I am trying to select and concatenate first_name and last_name and display the column as "Name". This is my query: Student.select("concat(first_name, ' ', last_name) as 'Name'").find(201410204) but it returns SELECT concat(first_name, ' ', last_name) as 'Name' FROM `students` WHERE `students`.`id` = 201410204 LIMIT 1 #<Student id: nil> but when i try to paste the query inside mysql workbench it return the student name that has the id 201410204 and the column name is "Name". Click to see the result of the query What's the problem about my code? Thanks |
How to use yield with dashboard sidebar to show contents on same page Posted: 24 Sep 2016 05:48 AM PDT I have a rails app with a functionality quite similar to yelp with a dashboard for customers where they can edit their place but also change their acccount settings, etc. A customer can only have one place for now. I've created a dashboard controller, views with a partial for the sidebar and everything is working so far but my problem is that when clicking on a link in the sidebar it yields to the application.html.erb. I want to yield everything from the sidebar to the main part of the dashboard/index.html.erb So my question is how do I yield the things I click in my sidebar to the part on the right next to the sidebar on the page. Basically the functionality is like a navbar on top (only for logged in customers) but I get confused with two yields. I tried "content_for" and <%= yield :sidebar %> but didn't figure out how to get it working yet. Also I am using devise with a user and customer model which share the views and have the functionality for the customer to edit his user account in the dashboard sidebar which might cause a problem with "content_for"? Please note that I am still learning ruby on rails and am very happy for any kind of input! dashboard_controller.rb def index @place = Place.where(customer_id: current_customer.id).first end dashboard/index.html.erb <div class="content"> <div class="sidebar"> <%= render 'dashboard/sidebar' %> </div> <div class="main"> <%= yield %> </div> </div> application.html.erb <body> <%= render 'layouts/shared/header' unless @disable_navbar %> <%= yield %> <%= render 'layouts/shared/footer' unless @disable_footer %> </body> |
Setting up ssl dns for Multiple domains for Rails and Heroku Posted: 24 Sep 2016 04:11 AM PDT I have a Rails application hosted on Heroku. For purposes of this example, let's assume the custom domain that I own is foo.com. I need to set up ssl for: - foo.com
- *.foo.com
- staging.foo.com
- *.staging.foo.com
I have used Cloudflare in the past as it provides free ssl and dns setup. It is my understanding that Cloudflare does not support 2 level subdomains i.e. *.staging.foo.com will not be covered by my dns and page rules. Am I correct in my understanding of Cloudflare? Currently my setup looks like this: - CNAME: foo.com -> foo.herokuapp.com
- CNAME: staging.foo.com -> staging_foo.herokuapp.com
- CNAME: *.staging.foo.com -> staging.foo.com
Up next I have some page rules setup: - http://foo.com/* -> Always route to HTTPS
- http://staging.foo.com/* -> Always route to HTTPS
- http://*staging.foo.com/* -> Always route to HTTPS
This seems to work for everything except the 2 level subdomain. Am I doing something incorrectly or is this a Cloudflare feature limitation? Are there any other services that I can make use of that offers low cost SSL(Wildcard) and DNS management? The budget is quite tight. Thanks |
How to add drag n drop functionality in rails Posted: 24 Sep 2016 06:42 AM PDT I want to add drag n drop functionality in my app like Draw.io and like trello. Meanz I need fast drag n drop in my app page. But I know how to do it? Please give me some guidelines? |
polygon 'contains' and other operations on geometries not supported Posted: 24 Sep 2016 04:36 AM PDT I'm quite new to postgis and rgeo. I suspect I may be tackling things in the wrong way but I have been a bit surprised to find out a few operations, in particular contains & within, aren't possible on spherical based objects. I have a bunch of geographically distributed objects which I would like to group together based on things like postcode. For each of of these groupings I have a boundary and I would like to check if an object is inside that boundary and also check if one boundary is inside another. I'm using rails and this is the migration used to set up my collection model class CreateGeoCollectionDefinition < ActiveRecord::Migration[5.0] def change create_table :geo_collection_definitions do |t| t.string :name t.string :geo_place_id t.string :geo_place_types, array: true, default: [] t.st_polygon :boundary, geographic: true t.jsonb :boundary_json t.st_point :latlng, geographic: true end end end Currently the boundary is coming from a google reverse geocode lookup. The NorthEast and SouthWest bounding box coordinates are passed into this method on object creation GEO_FACTORY = RGeo::Geographic.spherical_factory(srid: 4326) def self.createBoundary(pointOne, pointTwo) point1 = GEO_FACTORY.point(pointOne['lat'], pointOne['lng']) point2 = GEO_FACTORY.point(pointTwo['lat'], pointTwo['lng']) boundingBox = RGeo::Cartesian::BoundingBox.create_from_points(point1, point2).to_geometry boundingBox end I have written a few of specs to check that everything is behaving in the way that I expect. The simple distance based tests all pass as expected but there are issues with the ones used to test the boundary functionality. I run into the following # ------------------ # --- Caused by: --- # PG::UndefinedFunction: # ERROR: function st_contains(geography, geography) does not exist # LINE 1: ...COUNT(*) FROM "geo_collection_definitions" WHERE (ST_Contain... # ^ # HINT: No function matches the given name and argument types. You might need to add explicit type casts. When I try and run a query like (I know its a bit of a silly one) GeoCollectionDefinition.where("ST_Contains(boundary, boundary)") or if I try using the rgeo object directly it "should be possible to test is points belong in GeoCollection.boundary" do factory = RGeo::Geographic.spherical_factory(srid: 4326) externalPoint = factory.point(EmptyGeocodeLatLag['lng'], EmptyGeocodeLatLag['lat']) expect(someplace_def.boundary.contains?(someplace_def.latlng)).to be_truthy expect(someplace_def.boundary.contains?(externalPoint)).to be_falsy end I get RGeo::Error::UnsupportedOperation: Method Geometry#contains? not defined. Digging around I found this rgeo issue and other evidence that these operations are just not supported for spherical factory based objects I'm just wondering; - Is this definitely the case
- Modelling the boundary and the location of objects in the way described in my migration seems to make sense to me but I'm guessing I'm wrong about that?
- How should I go about finding out if a bunch of points are inside a polygon using postgis, rgeo and the active record adaptor?
- Is it possible to check if one polygon is inside another?
|
FastCGI not working with Rails 4 shared hosting (Phusion Passenger) Posted: 24 Sep 2016 03:02 AM PDT I am using Rails 4.1.6 and ruby 2.1.8p440. Currently, I want to speed up performance and add configure FastCGI. Problem: FastCGI doesn't work and slows down my RoR APP. So far I have this directory structure: - blogs (Rails 4 app)
- public_html
My .htaccess file: PassengerAppRoot "/home/individualki/blogs" PassengerBaseURI "/" PassengerRuby "/home/individualki/rubyvenv/ror/2.1/bin/ruby" RailsEnv development SetEnv RAILS_RELATIVE_URL_ROOT /dispatch RewriteEngine On RewriteRule ^(stylesheets/.*)$ - [L] RewriteRule ^(javascripts/.*)$ - [L] RewriteRule ^(images/.*)$ - [L] RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ dispatch.fcgi [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L] My dispatch.fcgi file: #!/home/individualki/rubyvenv/ror/2.1/bin/ruby ENV['RAILS_ENV'] ||= 'development' ENV['HOME'] ||= `echo ~`.strip ENV['GEM_HOME'] = File.expand_path('~/.gems') ENV['GEM_PATH'] = File.expand_path('~/.gems') + ":" + '/usr/lib/ruby/gems/1.8' require 'rubygems' Gem.clear_paths require 'fcgi' require '../home/individualki/blogs/config/boot.rb' require '../home/individualki/blogs/config/environment.rb' class Rack::PathInfoRewriter def initialize(app) @app = app end def cadsll(env) env.delete('SCRIPT_NAME') parts = env['REQUEST_URI'].split('?') env['PATH_INFO'] = parts[0] env['QUERY_STRING'] = parts[1].to_s @app.call(env) end end Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(blogs::Application) After that I restarted server with touch tmp/restart.txt Then accessed my web app and realized that it is not working properly. Content is loaded but without any assets - images, css or js files. App have become much slower. After that I checked my Cpanel and saw that my app now uses maximum proceses 40/40 and CPU usage is up. Those things never happened before (at leat I didn't saw it) My log file: Started GET "/dispatch/assets/parsley.js?body=1" for 85.254.76.76 at 2016-09-24 12:57:06 +0300 Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/routes/_route.html.erb (75.0ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/routes/_table.html.erb (1.6ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (367.4ms) ActionController::RoutingError (No route matches [GET] "/dispatch/assets/parsley.js"): actionpack (4.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' actionpack (4.1.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.1.6) lib/rails/rack/logger.rb:38:in `call_app' railties (4.1.6) lib/rails/rack/logger.rb:20:in `block in call' activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `block in tagged' activesupport (4.1.6) lib/active_support/tagged_logging.rb:26:in `tagged' activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `tagged' railties (4.1.6) lib/rails/rack/logger.rb:20:in `call' quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets' actionpack (4.1.6) lib/action_dispatch/middleware/request_id.rb:21:in `call' rack (1.5.3) lib/rack/methodoverride.rb:21:in `call' rack (1.5.3) lib/rack/runtime.rb:17:in `call' activesupport (4.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call' rack (1.5.3) lib/rack/lock.rb:17:in `call' actionpack (4.1.6) lib/action_dispatch/middleware/static.rb:64:in `call' rack (1.5.3) lib/rack/sendfile.rb:112:in `call' railties (4.1.6) lib/rails/engine.rb:514:in `call' railties (4.1.6) lib/rails/application.rb:144:in `call' /opt/passenger/lib/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request' /opt/passenger/lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request' /opt/passenger/lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop' /opt/passenger/lib/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads' Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/routes/_route.html.erb (44.4ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/routes/_table.html.erb (1.4ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (282.0ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.3ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/routes/_route.html.erb (25.0ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/routes/_table.html.erb (1.6ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (135.4ms) Started GET "/dispatch/assets/application.js?body=1" for 85.254.76.76 at 2016-09-24 12:57:07 +0300 ActionController::RoutingError (No route matches [GET] "/dispatch/assets/application.js"): actionpack (4.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' actionpack (4.1.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.1.6) lib/rails/rack/logger.rb:38:in `call_app' railties (4.1.6) lib/rails/rack/logger.rb:20:in `block in call' activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `block in tagged' activesupport (4.1.6) lib/active_support/tagged_logging.rb:26:in `tagged' activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `tagged' railties (4.1.6) lib/rails/rack/logger.rb:20:in `call' quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets' actionpack (4.1.6) lib/action_dispatch/middleware/request_id.rb:21:in `call' rack (1.5.3) lib/rack/methodoverride.rb:21:in `call' rack (1.5.3) lib/rack/runtime.rb:17:in `call' activesupport (4.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call' rack (1.5.3) lib/rack/lock.rb:17:in `call' actionpack (4.1.6) lib/action_dispatch/middleware/static.rb:64:in `call' rack (1.5.3) lib/rack/sendfile.rb:112:in `call' railties (4.1.6) lib/rails/engine.rb:514:in `call' railties (4.1.6) lib/rails/application.rb:144:in `call' /opt/passenger/lib/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request' /opt/passenger/lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request' /opt/passenger/lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop' /opt/passenger/lib/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads' Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.3ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/routes/_route.html.erb (30.7ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/routes/_table.html.erb (1.4ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (147.0ms) Started GET "/dispatch/assets/co.js?body=1" for 85.254.76.76 at 2016-09-24 12:57:07 +0300 ActionController::RoutingError (No route matches [GET] "/dispatch/assets/co.js"): actionpack (4.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' actionpack (4.1.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.1.6) lib/rails/rack/logger.rb:38:in `call_app' railties (4.1.6) lib/rails/rack/logger.rb:20:in `block in call' activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `block in tagged' activesupport (4.1.6) lib/active_support/tagged_logging.rb:26:in `tagged' activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `tagged' railties (4.1.6) lib/rails/rack/logger.rb:20:in `call' quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets' actionpack (4.1.6) lib/action_dispatch/middleware/request_id.rb:21:in `call' rack (1.5.3) lib/rack/methodoverride.rb:21:in `call' rack (1.5.3) lib/rack/runtime.rb:17:in `call' activesupport (4.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call' rack (1.5.3) lib/rack/lock.rb:17:in `call' actionpack (4.1.6) lib/action_dispatch/middleware/static.rb:64:in `call' rack (1.5.3) lib/rack/sendfile.rb:112:in `call' railties (4.1.6) lib/rails/engine.rb:514:in `call' railties (4.1.6) lib/rails/application.rb:144:in `call' /opt/passenger/lib/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request' /opt/passenger/lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request' /opt/passenger/lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop' /opt/passenger/lib/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads' Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.2ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/routes/_route.html.erb (31.6ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/routes/_table.html.erb (1.6ms) Rendered /home/individualki/rubyvenv/ror/2.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (150.2ms) Thanks in advance for any help. |
Rails: Migrate doesn't work Posted: 24 Sep 2016 07:23 AM PDT I have a little problem with my db schema. I have create a migration named messages but it was no good so I deleted them for replace by the good messages migration. But in my schema I have the last messages migration yet. how it's possible ? rails db:migrate:status: up 20160924085640 Create conversations up 20160924090519 Create messages schema.rb: create_table "conversations", force: :cascade do |t| t.integer "sender_id" t.integer "recipient_id" end create_table "messages", force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "subject" t.string "body" t.integer "recipient_id" t.integer "sender_id" end migration: class CreateMessages < ActiveRecord::Migration[5.0] def change create_table :messages do |t| t.text :body t.references :conversation, index: true t.references :user, index: true t.boolean :read, :default => false t.timestamps end end end routes resources :conversations do resources :messages end when I try to access to /conversations I have this error: uninitialized constant ConversationsController Thx for help :) |
Steps to install ibm_db in ubuntu with ruby 1.9.x and rails 3 Posted: 24 Sep 2016 02:44 AM PDT I keep getting errors while trying to install ibm_db. Does installing the gem require any prerequisites ? |
How do SPA on Rails Posted: 24 Sep 2016 02:30 AM PDT So, our team need to make a single page application on Rails 5. Maybe you have some experience with thisone. Which one is the best: Rails-api and frontend separately or usual Rails with assets pipeline and other features? Which web-framework is better: Angularjs or Angular 2? Or maybe Reactjs lib? Alternatives? Application will be some kind of platform for making payments. |
Mixin size arguments CSS issue Posted: 24 Sep 2016 02:54 AM PDT I have a Rails application where I have installed following gems - gem 'rails', '4.1.8' gem 'sass-rails' gem 'sass','3.4.22' gem "bourbon" gem "bootstrap-sass" gem "compass-rails" gem 'autoprefixer-rails' gem 'susy' In my application.css.scss *= require style *= require responsive @import "bootstrap-sprockets"; @import "bootstrap"; @import "compass"; @import "bourbon/bourbon"; @import "screen.scss"; @import "mobile.scss"; @import "ie.scss"; @import "print.scss"; When I run rails s and hit my URL I get following error: Mixin size takes 1 argument but 2 were passed. |
Rails - HTML table view with low to high graph Posted: 24 Sep 2016 01:47 AM PDT I want to have a table like the one below in my rails app. I did the below one using Jquery UI draggable and droppable. Screenshot of the table that i want I have data-factor-1 and data-factor-2 to each cell to send an AJAX on drop event like below $(".draggable").draggable({revert: "invalid"}); $('.droppable').droppable({ classes: { "ui-droppable-active": "ui-state-active", "ui-droppable-hover": "ui-state-hover" }, drop: function () { console.log("dropped"); $(".droppable").html("").removeClass("ui-state-highlight"); $(this).addClass("ui-state-highlight") updated_order = []; $.ajax({ method: 'POST', url: '/dropers/change', data: {} }) } }); I am stuck here at what should be the columns in database for necessary storage and how can i update that in rails views I know this is basics but i am new to Rails. Can anyone give me an idea on how to proceed? |
Configure rails from external gem Posted: 24 Sep 2016 01:30 AM PDT I am trying to configure my rails application from an external gem. Trying to build a central gem for handling logging related things.I am setting few loggly configs and trying to add custom params in loggly inspired from this post- Custom data to logs module Bizlogger class Railtie < Rails::Railtie # :nodoc: initializer 'bizlogger.configure_rails_initialization' do config = app.config Rails.application.configure do require 'syslogger' config.lograge.enabled = true config.lograge.custom_payload = proc do { host: request.host, user_id: current_user.try(:id), fwd: request.remote_ip } end end app.middleware.insert_before Rails::Rack::Logger, Bizlogger::Middleware, {} end def app #:nodoc: Rails.application end end end But I am getting NoMethodError when i am including this gem in my application /home/rakesh/.rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `lograge' for #<Rails::Application::Configuration:0x00000003959040> (NoMethodError) |
ruby on rails, how to using try() method in this case Posted: 24 Sep 2016 01:19 AM PDT I have a rails tag to call an attribute from an object like this <%= item.product.name %> but I got the error undefined method 'product' for nilClass. I've tried to use try() method like in the following code, it allows nill object from product, <%= item.try(:[], 'product') %>, but I don't know how to get name attribute from product now. edited: i try this code item.try(:product).try(:[], :name) the same code like mr @Andrey Daineko and mr @santhosh suggest, this is the result if product not nill, its work but it's still give this error if product is nill, |
gems are not working with rails 5 Posted: 23 Sep 2016 11:46 PM PDT I am using ruby 2.3.1 and rails 5.0.0.1 on Ubuntu. I tried to install gems like spree, milia and many others. They does not seem to work on rails 5.Is there anyway so that I can bulid my apps on rails5 using these gems? If not is it great idea to go back to old version of rails ? |
Sharing a repository and Sharing development database Posted: 24 Sep 2016 02:17 AM PDT I am currently working with ruby on rails on Cloud9 and using BitBucket. What i would like to know is, when i share my BitBucket repository with someone to work with together on the same project, how can i ensure that they are able to see my development data as well? Meaning if i have a Users table and i created 3 users in development, when they clone the git repository and work on their own Cloud9 server, would they be able to view the 3 users that i have created on my own workspace too? |
Rail5 pdf download with Ajax Request Posted: 24 Sep 2016 03:51 AM PDT I have an AJAX call $.ajax({ data: { 'inward_gate_id': document.getElementById("inward_gate_id_lorry_no").value, 'called_by': "GENERATEPDF" }, dataType: "script", method: 'get', success: function (data) { window.location.reload(); } }); And in my Controller send_data pdf.render, :filename => "report.pdf", :type=>"application/pdf", :x_sendfile => true THe log in terminal is as follows Rendering text template Rendered text template (0.0ms) Sent data report.pdf (0.5ms) But the pdf is not prompted for download |
Filter ActiveRecord records by nested resource logic - Rails Posted: 24 Sep 2016 03:17 AM PDT I'm building a task list app in rails which allows user to create task lists which contain tasks. I am trying set up filtering so I can display only task lists that have all of it's tasks marked as complete. Currently: List model: class List < ActiveRecord::Base belongs_to :user has_many :tasks end
Task model: class Task < ActiveRecord::Base belongs_to :list def completed? !completed_at.blank? end end As I understand it, ActiveRecord's .where query method only looks at at that model's fields and it's value (e.g: @lists.where(name: "List Name") ) Does anyone know a way of doing something similar to the pseudo code below: @completed_lists = @lists.where(list.tasks.completed.count == list.tasks.count) Thanks |
Rails 5: find all Users who belong to Companies, which belong to current_user Posted: 23 Sep 2016 11:41 PM PDT In my app User can have many Companies and vice versa. In Accounts table id of User and id of its Company is stored. I want to find all Users who belong to Companies, which belong to current_user. Let's assume that the current_user is like master User (not Admin, as that would be system Admin) of those companies. How do I do this? My guess is to do it with Arel, but then how should it look in Model, Controller, View? Many thanks for any help. I'm on Rails 5. models/user.rb class User < ApplicationRecord has_many :accounts, dependent: :destroy has_many :companies, through: :accounts models/account.rb class Account < ApplicationRecord belongs_to :company belongs_to :user accepts_nested_attributes_for :company, :user models/company.rb class Company < ApplicationRecord has_many :accounts, dependent: :destroy has_many :users, through: :accounts accepts_nested_attributes_for :accounts, :users My schema.rb looks like this: create_table "accounts", force: :cascade do |t| t.integer "company_id" t.integer "user_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["company_id"], name: "index_accounts_on_company_id" t.index ["user_id"], name: "index_accounts_on_user_id" end create_table "companies", force: :cascade do |t| t.string "name" t.string "legal_name" t.string "reg_number" t.string "address" t.string "bank_acc" t.string "description" t.string "website" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "role", default: 0 t.integer "currency", default: 0 end create_table "users", force: :cascade do |t| t.string "name" t.string "email" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "password_digest" t.string "remember_digest" t.boolean "admin", default: false t.index ["email"], name: "index_users_on_email", unique: true end |
Rails/Postgres - change default time in Time class Posted: 24 Sep 2016 12:54 AM PDT In my view, I will be ordering a list of items by their start_time . There are instances, however, where there might be a start_time of 1:00 AM (the following day) that should show up as after a start_time of 11:00 PM (previous day). Since the Time class stores a default date of 2001-01-01, it considers an entry of 1:00 AM to be on 2001-01-01, not 2001-01-02. Thus, my question is, is there a way to change the default date in the Time class? I suppose an obvious solution would be to instead store the start and end times in a DateTime class and enter a corresponding date. For this application, however, it is customary to refer to a start time of 1:00 AM as "belonging to" the previous day and would thus be confusing to enter the following day's date. (E.g. When attending your favorite band's concert on a Friday night, their set might start at 12:30 am Saturday morning, but you would still consider the concert to be on a Friday night). Thank you for your help. |
Devise Sign-Up Route End of File Reached Error Posted: 23 Sep 2016 09:31 PM PDT I've searched all over the internet for an answer to this error, but nothing seems to address it directly or effectively. I am using Devise in a Rails application and whenever I go to the users/sign_up page and submit the data, it will not submit properly and Rails gives me the error: "EOFError at /users end of file reached" Rails also includes this trace: rbuf_fill/Users/john/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/protocol.rb BUFSIZE = 1024 * 16 def rbuf_fill begin @rbuf << @io.read_nonblock(BUFSIZE) rescue IO::WaitReadable if IO.select([@io], nil, nil, @read_timeout) retry else raise Net::ReadTimeout Which I have had no luck following. From other posts, I believe something may be wrong with the mailer setup, but I've tried every solution recommended and I'm still getting this error. Currently, I have config.mailer_sender = SUPPORT_EMAIL setup in the config/initializers/devise.rb file. I would greatly appreciate any suggestions anyone has, as I've spent a ton of time on this with no luck. |
Can anyone tell me what the purpose of a Gemspec file in Ruby is? Posted: 23 Sep 2016 11:08 PM PDT After combing through Google I know what goes in a gemspec file for my project, but I have no clue as to why we need it, I guess I'm looking for a practical definition. (Currently working through Learn Ruby the Hard Way by Zed Shaw, this was one of the study questions) |
"Setting api_version is deprecated, only v2 will be supported" message Posted: 23 Sep 2016 08:38 PM PDT After running "rails console", I got the following message: setting api_version is deprecated and will be removed shortly, only v2 is supported Forgive my ignorance, but what exactly is being deprecated? |
Rails app not working with heroku Posted: 23 Sep 2016 10:44 PM PDT I'm trying to use sendgrid to send confirmation emails to users after they sign up. Everything was working before I tried configuring send grid, but now as soon as a user tries to sign up, I get the heroku error message to check the logs. I don't know what to make of the logs because every single thing is just a fatal error: 2016-09-24T02:33:00.151277+00:00 app[web.1]: F, [2016-09-24T02:33:00.151247 #3] FATAL -- : [e27b857c-d6d7-4e1d-a859-0abf408efa52] vendor/bundle/ruby/2.2.0/gems/actionmailer- 5.0.0.1/lib/action_mailer/message_delivery.rb:96:in `block in deliver_now' 2016-09-24T02:33:00.151307+00:00 app[web.1]: F, [2016-09-24T02:33:00.151277 #3] FATAL -- : [e27b857c-d6d7-4e1d-a859-0abf408efa52] vendor/bundle/ruby/2.2.0/gems/actionmailer- 5.0.0.1/lib/action_mailer/rescuable.rb:15:in `handle_exceptions' 2016-09-24T02:33:00.151373+00:00 app[web.1]: F, [2016-09-24T02:33:00.151307 #3] FATAL -- : [e27b857c-d6d7-4e1d-a859-0abf408efa52] vendor/bundle/ruby/2.2.0/gems/actionmailer-5.0.0.1/lib/action_mailer/message_delivery.rb:95:in `deliver_now' 2016-09-24T02:33:00.151406+00:00 app[web.1]: F, [2016-09-24T02:33:00.151374 #3] FATAL -- : [e27b857c-d6d7-4e1d-a859-0abf408efa52] vendor/bundle/ruby/2.2.0/gems/devise-4.2.0/lib/devise/models/authenticatable.rb:191:in `send_devise_notification' EDIT: Going back in the logs I found these 2016-09- 24T05:30:26.437967+00:00 app[web.1]: 2016-09-24T05:30:26.438280+00:00 app[web.1]: I, [2016-09-24T05:30:26.438213 #3] INFO -- : [7bde114c-61f1-45c8-9660-f4ce4dc1e7c1] Completed 500 Internal Server Error in 61ms (ActiveRecord: 6.2ms) 2016-09-24T05:30:26.440494+00:00 app[web.1]: F, [2016-09-24T05:30:26.440427 #3] FATAL -- : [7bde114c-61f1-45c8-9660-f4ce4dc1e7c1] 2016-09-24T05:30:26.440562+00:00 app[web.1]: F, [2016-09-24T05:30:26.440501 #3] FATAL -- : [7bde114c-61f1-45c8-9660-f4ce4dc1e7c1] Errno::ECONNREFUSED (Connection refused - connect(2) for "localhost" port 25): These are just the first few. I feel like they're not telling me enough to figure out how to fix the problem. The link to the repository if that helps at all: https://github.com/hbrodsk1/facebook Any guidance would be awesome because I'm truly stuck at this point. |
No comments:
Post a Comment