Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

James Jelinek's Profile

GitHub User: teknull

Comments by James Jelinek

Avatar

I'm not sure if heroku allows cron jobs or not but I had a similar issue with Passenger going to sleep after inactivity on a low traffic app. So in my crontab I added the following:

*/5 * * * * wget -O /dev/null -o /dev/null host.domain.com

This will issue a GET request every 5 minutes to your host and keep the app spun up. Note we output the results of wget to /dev/null to avoid any files being created on the server. Works like a charm.

Avatar

I have implemented this using the following:

jQuery ->
facilities = $('#call_transfer_from_id').html()

$('#call_region_id').change ->
region = $('#call_region_id :selected').text()
options = $(facilities).filter("optgroup[label=#{region}]").html()

if options
  $('#call_transfer_from_id').html(options)   
else
  $('#call_transfer_from_id').html($(options).attr('selected',true))

This works fine when changing the region. But when I need to edit the record and the form loads and I want to change the facility, all facilities are listed grouped by region whereas I'd like to have it constrain the facilities on page load. How can I combine .change and on load or document ready within this function so when I edit a record and the page loads I only see the facilities specific to that region?

Avatar

I was banging my head on how to preserve my search criteria into the CSV/XLS export. This worked great! Thanks for saving me the headache. I owe you Starbucks.

Avatar

I've used this code to try to get my search working using keyup. And I get an error in the console Uncaught SyntaxError: Unexpected token }

I literally cut/paste the code and changed the id name to patient_search.

Am I doing something wrong?

Avatar

This is a great railscast and I'm hoping to use this with States/Cities.

I'm still a bit new to rails and I don't understand the associations between the states and cities.

Say for instance I select the state of TX. I'd want only Houston, Austin, San Antonio, etc to show up. If I have a State and City model, how would I tie only those cities to the state.

I figured I could do
City.rb
belongs_to :state

State.rb
has_many :cities

And then put a state_id in the City model for the relationship.

But that would be a lot of manual work to get that done. Is there any way around this or a seed file that exists?

Avatar

I'm creating a CRM app where I'd like to have a dashboard that displays a feed of customer notes that were added and when. Looks like this gem will be helpful. I can see it being a lot of hits to the db if activity is heavy but I think it's worth a try.

Thanks for another great Railscast!

Avatar

Only thing I dislike about Heroku is the lack of Ruby 1.9.3 support

Avatar

Between this and Private Pub seems like a great solution. I have a use case for this gem however I will be using devise for authentication and need to somehow get the current_user and have them show up in a chat window.

Does anyone know a clean way to get this or something similar working. It's kind of pointless to have a chat system with 20 people logged in whom you can't tell who's who.

Thanks!

Avatar

Great episode as always. I'm a newb and working on my first app which will require real-time chat for users. I may be asking the wrong question here, but how would you go about private pub allowing a logged in user to display their name in the channel. Things could get messy with more than two users.

Thanks for your hard work!