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
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
anbublacky
@anbublacky

Hey,

Is there a way to convert [:profile_image, :profile_pictures] to [:profile_image, profile_pictures: []]? based on singular or plural?

梁先森
@LiangXianSen
hello, guys! I am new
梁先森
@LiangXianSen
I have a question, I have a background thread in config/initializers, that thread runs with run rails server. but also runs with rails generate. Is there a better way could solve this problem? thx!
jhass
@jhass:m.aeshna.de
[m]
@LiangXianSen: you didn't tell us anything about the problem :) What's the thread doing in the first place, why do you need it?
梁先森
@LiangXianSen
it is a kafka consumer, I need it that waits message and insert it to redis.
It is a I/O blocking thread, Is there an alternative method? @jhass:m.aeshna.de
jhass
@jhass:m.aeshna.de
[m]
I would recommend you to build it as a standalone script or as a rake task and run it independently of your application server
you can get the rails environment in any script by requiring config/application.rb in it. For a rake task just make it depend on the environment rake task to get the rails environment inside
梁先森
@LiangXianSen
if I build it as a rake task, could I bind it with the rails server run at the same time?
in production env, I just run bundle exec puma then done, I am finding a way to bind them together.
jhass
@jhass:m.aeshna.de
[m]
I would recommend you to not bind them together, there's little to no benefit to that
Just in the way you run puma run bundle exec rake kafka_consume or whatever alongside
梁先森
@LiangXianSen
At the beginning, I thought, if kafka_consume occurred error, let the main process rails server exit, maybe I could find another way.
thank you, I will try rake task.
Daniel Bretoi
@danielb2

I made an endpoint on a controller, and I'm jsut doing curl -X POST http://localhost/endpoint and I'm getting the error: ActionController::InvalidAuthenticityToken

I tried past recommendations of adding skip_before_filter :verify_authenticity_token but this doesn't appear to work. ANy ideas?

oh it got renamed to skip_before_action
Daniel Bretoi
@danielb2
I'm running dev mode, but all I see is "We're sorry, but something went wrong." when i get a 500. How can I fix this?
Daniel Bretoi
@danielb2
is there a better avenue for support ? Seems this is a bit dead
Emílio S. do Carmo
@emilio2hd
Hi everybody.
I was playing with Arel and notice the following scenario.
Writing this Arel::Table.new('db_name.schema_name.table_name').project(Arel.star).to_sql,
the output goes like :SELECT * FROM \"db_name\".\"schema_name\"
Is there any particular reason for arel chopping table_name?
kanroyalhigh
@kanroyalhigh
@emilio2hd not sure of this answer but i think it's only up to 2 levels of concatenating them
have you tried executing the sql to your backend db server?
drop the db_name and just the schema_name.table_name
or just the table_name
josephpalmezano
@josephpalmezano
How can i test a Serializer with rspec?
josephpalmezano
@josephpalmezano
should i?
Kaia Leahy
@tenebrousedge
are you testing anything other than library functionality?
josephpalmezano
@josephpalmezano

are you testing anything other than library functionality?

i just wanna know if Serializers should be unit tested

Kaia Leahy
@tenebrousedge
It's a general rule of thumb to only write unit tests when you are testing something that is not otherwise covered by tests for the library you're using. If you are simply enumerating which properties get serialized, and not performing any other transformation in said serializer, then don't bother writing tests
if your serializer is more complex, write tests to ensure that its behavior is correct
josephpalmezano
@josephpalmezano

It's a general rule of thumb to only write unit tests when you are testing something that is not otherwise covered by tests for the library you're using. If you are simply enumerating which properties get serialized, and not performing any other transformation in said serializer, then don't bother writing tests

go it! thanks!

Seif Eddine Slimene
@SeifESlimene
Hello anyone who knows how to debug the rails app? (either with VScode or JetBrains product like Rubymine)
Manu
@mtancoigne:matrix.org
[m]
@SeifESlimene: what do you mean "debug" ? My first shot would be to use byebug to stop execution and hand you a CLI in current context.
Seif Eddine Slimene
@SeifESlimene
Hello @mtancoigne:matrix.org , Thank you! but how I can do that exactly?
Manu
@mtancoigne:matrix.org
[m]
Here is the repo. It's included by default in Rails apps, you only have to add a byebug statement somewhere in your code and when the statement is reached you get the hand on the process.
Seif Eddine Slimene
@SeifESlimene
@mtancoigne:matrix.org Thanks! Can I add byebug inside a gem file?, I have code in a specific gem that I want to debug!
Manu
@mtancoigne:matrix.org
[m]
for sure, you can use it in any gem/ruby file, don't forget to require it if it's not auto-loaded.
Seif Eddine Slimene
@SeifESlimene
@mtancoigne:matrix.org Thanks but I can't show the content of variable how can I do this?
I did byebug list= self
Because I want to show the value of "self"
Manu
@mtancoigne:matrix.org
[m]
once the process stopped, just type in the variable name in the console. There are some reserved names tho (c, n, just type h to display the byebug help).
list is reserved by byebug ;)
Seif Eddine Slimene
@SeifESlimene
Can I send a screenshot here?
lukasbash
@lukasbash
Hi guys! I have a small question about update hooks. I have the use case that model A references several other models B, C and so on. It goes from 1:1, via 1:n up to n:m cardinality. Now, I would like to have a callback that I implement in model A which tells me that an attribute in e.g. model B changed. I would prefer to implement those hooks in the model A to keep everything related to this in one place where it is maintainable. Is there any option to do this with rails-native callbacks? I only found solutions for adding and removing entities inside a relation but not if one of the existing ones changes. May you help me out? Thank you!