Re: [Rails] Handling Hot Data with ActiveRecord

2015-07-23 Thread Scott Ribe
On Jul 23, 2015, at 7:14 AM, Mohit Sindhwani mo_m...@onghu.com wrote: * SELECT count(*) only with a limit of 900k records based on ID DESC, followed by the recorded_on part = 700ms * SELECT count(*) on the whole table using only recorded_on in the WHERE = 350ms That's kind of what I

Re: [Rails] Rails scheduled SMS sender

2015-07-23 Thread thiagocifani
Hello Marco, as you can see, you can send email or sms in the same way. The only thing you can do to avoid repetition, you should move the sms logic to a service class and instantiate it in the controller and in a rake task to send it from time to time. I hope I helped you somehow. 2015-07-23

Re: [Rails] Re: Looking For Ruby on Rails Software Consultant - Remotely

2015-07-23 Thread Colin Law
On 23 July 2015 at 17:47, Elizabeth McGurty emcgur...@gmail.com wrote: Who? Is this a general request to all that have responded? In the original post Susan T advised anyone interested how to respond. Colin -- You received this message because you are subscribed to the Google Groups Ruby on

[Rails] Re: ActiveRecord and consistent timestamps in transactions

2015-07-23 Thread Kenny Ortmann
I think this is a very important topic, but you posted it in the ruby-forum. You should repost it over in the rails forum or on the rails google group. As for my opinion on the matter, I think AR should not be setting the time itself and it should be using the database NOW function. Idea 2:

Re: [Rails] Error during program

2015-07-23 Thread Colin Law
On 23 July 2015 at 16:10, JYOTIR MOY CHATTERJEE sc3...@gmail.com wrote: An error occurred while installing json (1.8.3), and Bundler cannot continue. Make sure that `gem install json -v '1.8.3'` succeeds before bundling. how to fix this error?? Which operating system, and which version or

Re: [Rails] Rails scheduled SMS sender

2015-07-23 Thread Marco Dias
Thanks for your answer, The thing is, the mails being sent with the scheduled jobs are not in a Controller, they are in the UserMailer and they're easy to access via the UserMailer.daily_mail(user).deliver_now What I'd like to do, is having a similar thing with SMS. Maybe create a

[Rails] Rails scheduled SMS sender

2015-07-23 Thread Marco Dias
I want send an SMS each 5 minutes to my users. At the moment, my application sends an SMS during the creation of an account. # users_controller.rb def create @user = User.new(user_params) if @user.save @user.send_activation_email

Re: [Rails] Best practices with migrations in production deployments

2015-07-23 Thread Scott Ribe
On Jul 23, 2015, at 7:14 AM, Rafa F sephy...@gmail.com wrote: Ok, and if I decided to work with migrations, what is the best way deploying in a production environment? Run a rake db:migrate in a production platform sounds like a little dangerous... You need to review and test your

Re: [Rails] Best practices with migrations in production deployments

2015-07-23 Thread Rafa F
Ok! Understood! :^) Thank you so much for your help. El jueves, 23 de julio de 2015, 15:18:10 (UTC+2), Scott Ribe escribió: On Jul 23, 2015, at 7:14 AM, Rafa F seph...@gmail.com javascript: wrote: Ok, and if I decided to work with migrations, what is the best way deploying in a

Re: [Rails] Best practices with migrations in production deployments

2015-07-23 Thread Scott Ribe
On Jul 23, 2015, at 6:16 AM, Rafa F sephy...@gmail.com wrote: In rails every evolution of a model must be executed through migrations, isn't it? No. You don't have to use migrations at all; if you're managing your db schema some other way already, you can continue to do so. Migrations are a

Re: [Rails] Best practices with migrations in production deployments

2015-07-23 Thread Rafa F
Thanks for your fast answer! :^) Ok, and if I decided to work with migrations, what is the best way deploying in a production environment? Run a *rake db:migrate *in a production platform sounds like a little dangerous... Thanks again! El jueves, 23 de julio de 2015, 14:55:31 (UTC+2), Scott

Re: [Rails] Handling Hot Data with ActiveRecord

2015-07-23 Thread Mohit Sindhwani
Hi Scott, On 23/7/2015 8:12 PM, Scott Ribe wrote: Because it was the count(distinct x) that was the problem :) Doing only a count(*) is faster without the subquery... and is what we have switched to. So does the limit reduce it to less than 1 day's rows? Yes, the idea of the limit (900k

[Rails] CSRF protection for faye pub/sub

2015-07-23 Thread Wenqin Ye
I am trying to implement Csrf_protection for faye pub/sub chat app (tutorial is here: http://faye.jcoglan.com/security/csrf.html) class CsrfProtection def incoming(message, request, callback) session_token = request.session['_csrf_token'] message_token = message['ext']

[Rails] Manual implementation of Csrf Protection?

2015-07-23 Thread Wenqin Ye
I am implementing the code in this faye pub/sub tutorial(http://faye.jcoglan.com/security/csrf.html) -- go to the example rails section to see the code I am talking about. What it does is when a message is to be published, it goes through the CsrfProtection class. Session_token comes from the

Re: [Rails] More practice for rails

2015-07-23 Thread tamouse pontiki
Get and read Justin Weiss's Practicing Rails book ( https://www.justinweiss.com/practicing-rails/). That said, pick one smaller aspect out of rails (say ActiveRecord::Serializers) and go to town building practice apps with models and tests and just work it until you know it cold. In fact, work

Re: [Rails] Re: sunspot_configuration.rb:52:in `block in top (required)': undefined method `gsub' for nil:NilClass

2015-07-23 Thread Agustina Diaz de Tuesta
Thanks for your answer! I understand that It shouldn't have changed just because I uploaded it, the thing is I did make some minor changes (on the views) and upload them without checking on the local host but on the remote server. Everything is working perfectly on the server under production,

Re: [Rails] Speed Your Rails App with Model Caching using Redis.

2015-07-23 Thread tamouse pontiki
I'd like to toss in the gem bullet, which we've begun using in one of our apps, that shows database queries that are slow and how to speed them up. That said, I still have to give Knuth's remark: Premature optimisation is the root of all evil. Basically: don't start optimising until you have

Re: [Rails] sunspot_configuration.rb:52:in `block in top (required)': undefined method `gsub' for nil:NilClass

2015-07-23 Thread tamouse pontiki
On Wed, Jul 22, 2015 at 10:45 AM, agusddt agus...@gmail.com wrote: I was uploading my app to a server, put it in production mode on the server, still on development mode locally and suddenly I cannot run rails server anymores since it dies automatically with this error:

Re: [Rails] Best practices with migrations in production deployments

2015-07-23 Thread tamouse pontiki
On Thu, Jul 23, 2015 at 8:22 AM, Rafa F sephy...@gmail.com wrote: Ok! Understood! :^) Thank you so much for your help. El jueves, 23 de julio de 2015, 15:18:10 (UTC+2), Scott Ribe escribió: On Jul 23, 2015, at 7:14 AM, Rafa F seph...@gmail.com wrote: Ok, and if I decided to work with

[Rails] Re: Looking For Ruby on Rails Software Consultant - Remotely

2015-07-23 Thread S. T.
Elizabeth McGurty wrote in post #1176827: Who? Is this a general request to all that have responded? Elizabeth If you are interested in the opportunity, please send me your resume at str...@sdncentral.com. We can then talk via email. Thanks! -- Posted via http://www.ruby-forum.com/. -- You

[Rails] Suggestions For Deprecation Of `serialized_attributes`

2015-07-23 Thread Carson Reinke
I read through the pull request (https://github.com/rails/rails/pull/15704) of the deprecation of `serialized_attributes`. I was wondering what I should do in the future. The PR mentions using polymorphism, however, what should I use when the serialization does not represent a database

[Rails] Re: Suggestions For Deprecation Of `serialized_attributes`

2015-07-23 Thread Carson Reinke
Ha! Ok, yes I see that now. Thank you! On Thursday, July 23, 2015 at 10:05:30 AM UTC-4, Frederick Cheung wrote: On Thursday, July 23, 2015 at 3:03:19 PM UTC+1, Carson Reinke wrote: I read through the pull request ( https://github.com/rails/rails/pull/15704) of the deprecation of

[Rails] Re: Suggestions For Deprecation Of `serialized_attributes`

2015-07-23 Thread Frederick Cheung
On Thursday, July 23, 2015 at 3:03:19 PM UTC+1, Carson Reinke wrote: I read through the pull request (https://github.com/rails/rails/pull/15704) of the deprecation of `serialized_attributes`. I was wondering what I should do in the future. The PR mentions using polymorphism, however,

[Rails] Error during program

2015-07-23 Thread JYOTIR MOY CHATTERJEE
An error occurred while installing json (1.8.3), and Bundler cannot continue. Make sure that `gem install json -v '1.8.3'` succeeds before bundling. how to fix this error?? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe

[Rails] Re: Error during program

2015-07-23 Thread Elizabeth McGurty
Please run gem list to see if its already installed. Rails 3 or Rails 4? Can you show us your complete error information? On Thursday, July 23, 2015 at 11:41:12 AM UTC-4, JYOTIR MOY CHATTERJEE wrote: An error occurred while installing json (1.8.3), and Bundler cannot continue. Make

Re: [Rails] Handling Hot Data with ActiveRecord

2015-07-23 Thread Scott Ribe
On Jul 22, 2015, at 11:27 PM, Mohit Sindhwani mo_m...@onghu.com wrote: Hi Scott, On 23/7/2015 11:54 AM, Scott Ribe wrote: On Jul 22, 2015, at 9:10 PM, Mohit Sindhwani mo_m...@onghu.com wrote: We have tried this and the query is quite a bit slower. Filtering to the last 900k records

[Rails] Best practices with migrations in production deployments

2015-07-23 Thread Rafa F
Hi every one! In rails every evolution of a model must be executed through migrations, isn't it? And if it must be done this way, how can we control migrations in a production deployment? We have to take care of our data during the migrations in order to don't erase anything. What is the

[Rails] Re: Looking For Ruby on Rails Software Consultant - Remotely

2015-07-23 Thread Elizabeth McGurty
Who? Is this a general request to all that have responded? On Wednesday, July 22, 2015 at 9:04:40 PM UTC-4, Ruby-Forum.com User wrote: Can you send me your resume and rate at str...@symplexity.com javascript:? Thanks! -- Posted via http://www.ruby-forum.com/. -- You received this

[Rails] Speed Your Rails App with Model Caching using Redis.

2015-07-23 Thread Areba Biggie
While learning Rails, little emphasis is given on performance partly because most of those tutorials are usually small applications with minimal records. But as one progresses and starts handling huge apps, performance becomes critical. Optimizing queries and handling bottlenecks such as N + 1