Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 19 2018 23:23
    kiddrew commented #14160
  • Nov 19 2018 23:23
    gmcgibbon synchronize #34468
  • Nov 19 2018 23:23
    kiddrew commented #14160
  • Nov 19 2018 23:12
    kamipo commented #34316
  • Nov 19 2018 23:10
    oniofchaos commented #34218
  • Nov 19 2018 23:09
    rafaelfranca synchronize #30320
  • Nov 19 2018 23:08
    oniofchaos commented #34236
  • Nov 19 2018 23:07
    rafaelfranca closed #34487
  • Nov 19 2018 23:07

    rafaelfranca on master

    Prevent TextHelper#word_wrap fr… Merge pull request #34488 from … (compare)

  • Nov 19 2018 23:07
    rafaelfranca closed #34488
  • Nov 19 2018 23:06
    rafaelfranca review_requested #34308
  • Nov 19 2018 23:05
    oniofchaos commented #34280
  • Nov 19 2018 23:01
    oniofchaos commented #34308
  • Nov 19 2018 22:52
    rafaelfranca synchronize #30320
  • Nov 19 2018 22:51

    rafaelfranca on master

    Indent guides as rails help com… Homogenize rails help output I… Merge pull request #34085 from … (compare)

  • Nov 19 2018 22:51
    rafaelfranca closed #34085
  • Nov 19 2018 22:51
    rafaelfranca commented #33643
  • Nov 19 2018 22:51
    rafaelfranca closed #33643
  • Nov 19 2018 22:50

    rafaelfranca on 5-2-stable

    Merge pull request #34106 from … (compare)

  • Nov 19 2018 22:49
    rafaelfranca synchronize #30320
Oleksandr Bratashov
@abratashov
thanks!
Srinivasan
@kksrini89

Hello guys, can anyone please help me?

I am trying to install ruby 2.3.x with rvm in Mac os Catalina. Getting errors spending last 2 days on this.

Thomas Bromehead
@thomasbromehead
@kksrini89 what's your issue? Do you have a stacktrace?
I suggest going through this book from Launchschool, there's a whole section dedicated to RVM.
https://launchschool.com/books/core_ruby_tools/read/ruby_version_managers#rvm
If you do a type rvmit should output function, if not you need to reinstall it.
Thomas Bromehead
@thomasbromehead
Did you ever find a solution to your issue @kksrini89 ?
Scott Giminiani
@ScottG489
I'm looking to load a media player (jwplayer) and it's thumbnail image earlier on browser page load. Is there a way I can prioritize it over other assets? Sorry if this is just a general frontend question but I was thinking maybe there would be a way with the asset pipeline. For context I'm trying to improve "page experience" in (chrome) lighthouse by having the player load faster. Specifically the LCP (largest contentful paint)
Thomas Bromehead
@thomasbromehead

Hi @ScottG489, with HTTP2 you can do stream prioritization.
Never implemented it myself but have a look here (scroll down to the Stream Prio paragraph):
https://www.speedshop.co/2016/01/07/what-http2-means-for-ruby-developers.html
https://discuss.rubyonrails.org/t/what-is-the-story-with-http-2-in-rails/75224/3

Definitely something to learn here

Scott Giminiani
@ScottG489
Thanks @thomasbromehead. I'll take a look
gerome0123
@gerome0123

I have this model Person
class Person
generate_public_uid generator: PublicUid::Generators::HexStringSecureRandom.new(32)

         has_many :addresses, as: :resource, dependent: :destroy
         accepts_nested_attributes_for :addresses, allow_destroy: true, update_only: true,
                                reject_if: proc { |attrs| attrs[:content].blank? }
     end

in my person table, I have this public_id that is automatic generated when a person is created. now the nested attribute in adding addresses is working fine. but the update is not the same as what nested attribute default does. my goal is to update the addresses using public_id

class Address
generate_public_uid generator: PublicUid::Generators::HexStringSecureRandom.new(32)

   belongs_to :resource, polymorphic: true

end
this is my address model

I'm using the public id to my primary key. and trying to update nested attribute using the public_id

PavitKaur05
@PavitKaur05
Hi, I just have a quick question and thankful if somebody could answer it, the question is that whether :public and :private could be used to give as values for a enum type attribute for a model or should it give error since those are keywords in rails or ruby?
mtancoigne
@mtancoigne:matrix.org
[m]
@PavitKaur05: Good question, unfortunately I don't have the answer. I'd say "yes you can 'cause a symbol is not the same as the keyword", but have nothing to confirm this.
can we define a "private method?" ?
class Testit
  def private
    puts 'ok, its private then'
    private_thing
  end
  private

  def private_thing
   puts ' test'
  end
end
a = Testit.new
a.private
# ok, its private then
# test
but a class method named private messes up the class:
mtancoigne
@mtancoigne:matrix.org
[m]
class Plop
  def self.private
    puts 'yep?'
  end

  private

  def self.plop
    private
  end
end
yep?
=> :plop
private() is called on class definition...
TL;DR, nope, you can't (enums ends up as class methods, aren't they ?)
PavitKaur05
@PavitKaur05
Yeah by what I read, I know it adds extra methods as in catalog.published? for
class Catalog < ActiveRecord::Base
enum status: [:published, :unpublished, :not_set]
end
So @mtancoigne:matrix.org can we conclude that we cannot keep those values for enum?
mtancoigne
@mtancoigne:matrix.org
[m]
catalog.published? is an instance method; an instance method named private seems ok (example. 1)
PavitKaur05
@PavitKaur05
Okay, got it. Thanks @mtancoigne:matrix.org
mtancoigne
@mtancoigne:matrix.org
[m]
I don't know if rails create class methods for enums, in which case there may be a problem (eg: Catalog.status to get the enum)
well, I tested this, and for a nature enum, Rails creates MyClass.natures
so finally, go for it :)
Neil Fernandes
@neil-sib
Does anyone have experience with AASM gem? I need help how to display the states as a drop down in the frontend.
Kaia Leahy
@tenebrousedge
@neil-sib
Neil Fernandes
@neil-sib
@tenebrousedge - Thankyou! I went ahead with a radio button approach.
Huy Vo
@huyvohcmc
Hi guys, what is the best way to handle requests with an unparseable JSON body in Rails 5.0.7.2?
I was able to handle such bad requests using this article in Rails 4: https://thoughtbot.com/blog/catching-json-parse-errors-with-custom-middleware
But it won't work in Rails 5.0.7.2
but the custom middleware didn't catch the error