Francisco Quinones

Joined

7,370 Experience
40 Lessons Completed
2 Questions Solved

Activity

im in the Video yay lol Chris keep up the good work

Posted in How to add logo image to mailer

O yes, I start reading about CORS but looks to shallow for me at the moment. As the problem with the fonts is on my site and not in the email. If I disable the image on email and hide the config for that all goes back to normal. So yes need to do a workaround the email images and the font cross site.

Posted in GoRails speed

Isaac Will do I started watching it the other day. ill will see it soon. thank you Chris is always on point with the topics

Posted in Migration Issue caused Heroku to fail.

oh this error is the position of the paperclip method you need to have the has_attachment before the validation.

Posted in GoRails speed

+1 thanx

Posted in How to add logo image to mailer

@chris I use that approach but that get me another error.

 Font from origin has been blocked from loading by Cross-Origin Resource Sharing policy 

The email show the logo but now fonts are missing.
has I'm using subdomain

Posted in lazy high charts gem

can you add your code and what you're expecting the result to be.

@chris will love to see an episode on this topic

Posted in How to add logo image to mailer

Hi how can we add image from my assets to the email like my logo when sending email to the users.

Posted in Upgrading simple_calendar for Rails 5 Discussion

like the new intro

Thank you chris for this cover on this great gem

Quick question Chris what happen if you have different user and different role like this.
This is the users like me the owner of the services.
"App Owner" User Model
Roles:
Super Admin
Moderator
This is the users that are using the service

User Model + Customer User Model
Roles:
Manager
Admin
Vendors
Services
more ...
This is the client of my customer
User Model + Client User Model
Roles:
Manager
General Manager

What techniques will you use for this?

This what I did.

User Model
has_one :client_user
has_one :customer_user

ClientUser
belongs_to :user

CustomerUser
belongs_to :user

And Role with Cancancan for the User

Freaking Love it Chris your on point all the time! love it love it. Thank you has always.

Posted in Rspec Test on Multi tanent app with aparment gem

Hi I'm having a hard time figuring this out.

https://gist.github.com/Frank004/8aa4acf20f60a3666a42

Im starting to do test on my Multitenant app and encounter a problem when trying to run the project_spec.rb
I get this error:

  $ bundle exec rspec spec/models/project_spec.rb 
 F

Failures:

 1) Project has a valid factory
 Failure/Error: Apartment::Tenant.create(subdomain)

 Apartment::TenantExists:
   The schema companydemo already exists.
 # ./app/models/company.rb:67:in `create_tenant'
 # ./spec/models/project_spec.rb:5:in `block (2 levels) in <top (required)>'
 # ------------------
 # --- Caused by: ---
 # PG::DuplicateSchema:
 #   ERROR:  schema "companydemo" already exists
 #   ./app/models/company.rb:67:in `create_tenant'

 Finished in 1.22 seconds (files took 4.13 seconds to load)
  1 example, 1 failure
  Failed examples:
  rspec ./spec/models/project_spec.rb:12 # Project has a valid factory

What im looking for is how can I do test on a multitenant playing nice with the Company Model callback for creating tenant when a Company is create. I know I need to setup some before logic.
Im new to test so please any help on how to solve this problem.

Thank you.

Posted in Deploying To Production on Heroku with Puma Discussion

thnx Chris for the quick response as always. works great the app performance double just by changing from unicorn to puma.

Posted in Deploying To Production on Heroku with Puma Discussion

So chris im using this on my db.yml file

production:
<<: *default
host: xxxxxxx
database: xxxxxx
password: xxxxx
port: xxxxxx
username:xxxxx

on your video you paste this code

production:
url: <%= ENV["DATABASE_URL"] %>
pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %>

• form my db.yml code what parts I need to change.
• on heroku Config Vars I only have the DATABASE_URL its the DB_POOL build by puma??

thank you.

Posted in Sharing Data With Javascript Discussion

more like this pls!!

I found that this works

<%= link_to Report, project_incidents_path(params.merge(format: "pdf")), :class=> "btn" %>

I get this

http://companydemo.lvh.me:3000/projects/conroy-schamberger-and-crooks/incidents?action=index&commit=Buscar&controller=incidents&format=pdf&from_date=01%2F01%2F2016&project_id=conroy-schamberger-and-crooks&to_date=31%2F01%2F2016&utf8=%E2%9C%93

but I dont know if is the best way.

So Chris im using prawn pdf in my app.
Now im adding some search form to filter by date range. All works fine and I get my filter table on my index. my problem is with prawn that wont hold the filter records

my form filter range

        <%= form_tag({controller: "accidents", action: "index"}, {:class => 'navbar-form navbar-left', method: "get"}) do %>
              <%= text_field_tag :from_date, params[:from_date], class: "form-control", placeholder: "Fecha Inicial" %>
              <%= text_field_tag :to_date, params[:to_date], class: "form-control", placeholder: "Fecha Final" %>
              <%= submit_tag 'Buscar', class: "btn btn-primary" %>
        <% end %>

my controller code

  def index
    if params[:from_date] && params[:to_date].present?
       from_date = Date.strptime(params[:from_date], "%d/%m/%Y")
       to_date = Date.strptime(params[:to_date], "%d/%m/%Y") + 1.day
       @accidents = @project.accidents.sorting.where(:date => from_date..to_date)
       .paginate(:page => params[:accidents], :per_page => 10)
    else
        @accidents = @project.accidents.sorting.paginate(:page => params[:accidents], :per_page => 10)
    end
    respond_to do |format|
        format.html
        # format.csv { send_data  @accidents.to_csv}
        format.pdf do
          pdf = AccidentsReportPdf.new(@accidents,@project)
          send_data pdf.render,filename: "accidente_reporte_#{@project.name}.pdf",
                              type: "application/pdf",
                              disposition: "inline"
      end
    end
  end

This my index filter with a range of date

http://companydemo.lvh.me:3000/projects/conroy-schamberger-and-crooks/accidents?utf8=%E2%9C%93&from_date=01%2F01%2F2016&to_date=31%2F01%2F2016&commit=Buscar

when I go to see the pdf version

<%= link_to Report, project_incidents_path(format: "pdf"), :class=> "btn" %>

I get

  http://companydemo.lvh.me:3000/projects/conroy-schamberger-and-crooks/accidents.pdf

maybe I need to past the dates to the link_to pdf. If so how is the right way to pass that data.

@chris on my sideq im getting this error any idea??

09:37:22 redis_s.1 | 33693:M 07 Dec 09:37:22.096 * 100 changes in 300 seconds. Saving...
09:37:22 redis_s.1 | 33693:M 07 Dec 09:37:22.097 * Background saving started by pid 71671
09:37:22 redis_s.1 | 71671:C 07 Dec 09:37:22.099 * DB saved on disk
09:37:22 redis_s.1 | 33693:M 07 Dec 09:37:22.197 * Background saving terminated with success
09:39:27 worker.1  | 2015-12-07T13:39:27.825Z 33694 TID-ougbxml30 DelayedPaperclip::Jobs::ActiveJob JID-9570d2fa326ad3b1bbc24651 INFO: start
09:39:28 worker.1  | 2015-12-07T13:39:28.299Z 33694 TID-ougbxml30 DelayedPaperclip::Jobs::ActiveJob JID-9570d2fa326ad3b1bbc24651 INFO: fail: 0.474 sec
09:39:28 worker.1  | 2015-12-07T13:39:28.300Z 33694 TID-ougbxml30 WARN: {"class"=>"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper", "wrapped"=>"DelayedPaperclip::Jobs::ActiveJob", "queue"=>"paperclip", "args"=>[{"job_class"=>"DelayedPaperclip::Jobs::ActiveJob", "job_id"=>"44d6026e-5aca-4a07-9d18-054e75bd0eb7", "queue_name"=>"paperclip", "arguments"=>["TaskTran", 449, "signature_manager"], "locale"=>"es"}], "retry"=>true, "jid"=>"9570d2fa326ad3b1bbc24651", "created_at"=>1449495208.7341068, "apartment"=>"companydemo", "enqueued_at"=>1449495567.8203, "error_message"=>"One of the following schema(s) is invalid: \"companydemo\" \"public\"", "error_class"=>"Apartment::TenantNotFound", "failed_at"=>1449495209.205343, "retry_count"=>4, "retried_at"=>1449495568.298719}
09:39:28 worker.1  | 2015-12-07T13:39:28.300Z 33694 TID-ougbxml30 WARN: Apartment::TenantNotFound: One of the following schema(s) is invalid: "companydemo" "public"
09:39:28 worker.1  | 2015-12-07T13:39:28.301Z 33694 TID-ougbxml30 WARN: /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/apartment-1.0.2/lib/apartment/adapters/postgresql_adapter.rb:92:in `rescue in connect_to_new'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/apartment-1.0.2/lib/apartment/adapters/postgresql_adapter.rb:85:in `connect_to_new'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/apartment-1.0.2/lib/apartment/adapters/abstract_adapter.rb:84:in `switch!'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/apartment-1.0.2/lib/apartment/adapters/abstract_adapter.rb:97:in `switch'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/apartment-sidekiq-0.2.0/lib/apartment/sidekiq/middleware/server.rb:4:in `call'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/logging.rb:30:in `with_context'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/middleware/server/logging.rb:7:in `call'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/middleware/chain.rb:132:in `call'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/middleware/chain.rb:132:in `invoke'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/processor.rb:51:in `block in process'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/processor.rb:104:in `stats'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sidekiq-3.5.3/lib/sidekiq/processor.rb:50:in `process'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/celluloid-0.17.2/lib/celluloid/calls.rb:28:in `public_send'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/celluloid-0.17.2/lib/celluloid/calls.rb:28:in `dispatch'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/celluloid-0.17.2/lib/celluloid/call/async.rb:7:in `dispatch'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/celluloid-0.17.2/lib/celluloid/cell.rb:50:in `block in dispatch'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/celluloid-0.17.2/lib/celluloid/cell.rb:76:in `block in task'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/celluloid-0.17.2/lib/celluloid/actor.rb:339:in `block in task'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/celluloid-0.17.2/lib/celluloid/task.rb:44:in `block in initialize'
09:39:28 worker.1  | /Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/celluloid-0.17.2/lib/celluloid/task/fibered.rb:14:in `block in create'
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.