Francisco Quinones

Joined

7,370 Experience
40 Lessons Completed
2 Questions Solved

Activity

Posted in In-App Navbar Notifications Discussion

Thank you thank you thank you!

Posted in Group records by month to display in a chart

thankyou thats the best solution.

Posted in Group records by month to display in a chart

Chris How can I filter the queries with out duplicating the code so much as Im breaking my head. I like to keep it all dry up and few querys
can you giving me a example of your approach. thankyou.

Posted in Group records by month to display in a chart

Chris if I do.
@tasks = Task.group_by { |t| t.start_date.strftime("%B/%Y")}
@finished = @tasks.select{ |task| task.status == 'Complete' }

I get a error

   NoMethodError: undefined method `status' for "November/2015":String
from (irb):136:in `block in irb_binding'
from (irb):136:in `select'

I think that @tasks its using a K,V and when im reading the .select{ |task| task.status} its doing this

 k = "November/2015"
 k.status

Posted in Group records by month to display in a chart

Chris can I use any of this scope for that??

scope :cancel, lambda {where(:status => "Cancelada")}
scope :unfinish, lambda {where(:status => "Expirada")}
scope :pending, lambda {where(:status => "Pendiente")}
scope :finish, lambda {where(:status => "Completada")}
scope :transfer, lambda {where(:move_task => true)}

Posted in Group records by month to display in a chart

Nice more clean love it what I was looking. Chris Thank you for all the help for the pass few months. my app looks great with all the help.

Posted in Group records by month to display in a chart

    @finish , @unfinish = [], []
@tasks.each do |t|
    @finish << t if t.status == 'Complete'
    @unfinish << t if t.status == 'Cancel'
end

Posted in Group records by month to display in a chart

more details of my problem. Im looking for a way to make the code more dry, has I need to display all the Task, and Task by status. So your getting a bar chart with Task complete, Task Pending and Task cancel. With this code I can display alll task. so now how can I use this code but to display each status on the chart. without duplicating the code.

Controller

@months = Array.new
@total_tasks = Array.new
@tasks = Task.group_by { |t| t.start_date.strftime("%B/%Y")} 
@tasks.reverse_each do |key, value|
    @months << key
    @total_tasks << value.size
end

With this line I get the same output

   Task.group_by_month(:date, format: "%b %Y").count

VIEW

<div id="chart_tasks" style="min-width: 210px; max-width: auto; height: 400px; margin: 0 auto"></div>
<%= javascript_tag do %>
   window.months = JSON.parse('<%= raw @months%>')
   window.total_tasks = JSON.parse('<%= raw @total_tasks%>')
<% end %>

$(function () {
    $('#chart_tasks').highcharts({

        xAxis: {
            categories: months
        }, 

        series: [{
                name: ' Task Total',
                type: 'column', 
                data: total_tasks,
                dataLabels: {
                        enabled: true,
                        color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'black'
                    }
            }
    });
});

Posted in Group records by month to display in a chart

Hi Chris Im using HighChart and I have some data that want to display in group by month.

Posted in Subdomains Email reset with Devise

Hi Chris so im trying to work with subdomain and maindomain email reset password
I use the code on devise and for subdomain work like a charm but for the main domain I get this erro because they down have @company.subdomain
https://github.com/plataformatec/devise/wiki/How-To:-Send-emails-from-subdomains

<%= link_to 'Cambiar contraseƱa', edit_password_url(@resource, reset_password_token: @token, :subdomain => @resource.company.subdomain) %>

any need to use it only if reques is from a subdomain.

Posted in Manage Assets With Rails Assets Discussion

greatwork Chris

Posted in Advice on building a 'reports' feature

@chris will love to see a tutorial on this topic.

@chris im ready to deploy to heroku. how can I setup my cron jobs on heroku or im all set and the whenever gem will setup and tell the cron jobs to run. thank for all the help.

@chris Thank move to sidekiq work out of the box. thank you

@chris another quick question. You told me to use resque better for background jobs, for some reason resque is not looking at the sub tenant, I get a error Record ID not found I think its looking on the main table and not that subdomain table.

   Couldn't find TaskTran with 'id'=26
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.4/lib/active_record/relation/finder_methods.rb:324:in `raise_record_not_found_exception!'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.4/lib/active_record/relation/finder_methods.rb:444:in `find_one'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.4/lib/active_record/relation/finder_methods.rb:423:in `find_with_ids'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.4/lib/active_record/relation/finder_methods.rb:71:in `find'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/delayed_paperclip-2.9.1/lib/delayed_paperclip.rb:34:in `process_job'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/delayed_paperclip-2.9.1/lib/delayed_paperclip/jobs/active_job.rb:12:in `perform'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/execution.rb:32:in `block in perform_now'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:117:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:117:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:343:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/i18n-0.7.0/lib/i18n.rb:257:in `with_locale'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/translation.rb:7:in `block (2 levels) in <module:Translation>'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:441:in `instance_exec'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:441:in `block in make_lambda'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:342:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:342:in `block in simple'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:497:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:497:in `block in around'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:343:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/logging.rb:23:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/logging.rb:23:in `block (4 levels) in <module:Logging>'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `block in instrument'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `instrument'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/logging.rb:22:in `block (3 levels) in <module:Logging>'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/logging.rb:43:in `block in tag_logger'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/tagged_logging.rb:26:in `tagged'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/tagged_logging.rb:68:in `tagged'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/logging.rb:43:in `tag_logger'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/logging.rb:19:in `block (2 levels) in <module:Logging>'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:441:in `instance_exec'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:441:in `block in make_lambda'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:342:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:342:in `block in simple'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:497:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:497:in `block in around'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:778:in `_run_perform_callbacks'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/execution.rb:31:in `perform_now'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/execution.rb:21:in `execute'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/queue_adapters/resque_adapter.rb:46:in `perform'

quick question cron jobs run normal on Multitenancy app
This the code that I have if it dont run normal I was think of doing the block code so it runs in each tanent

  # Company.all.each  do |c|
  # Apartment::Tenant.switch!('c.subdomain')
   every 1.month, :at => '1st 6:00am' do
        runner "User.email_task_list"
        runner "Task.generate_new_trans" # class Task.method
   end
    # end

Posted in What is the spinning icon I see on GoRails?

@chris can we use this on are production apps???

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.