by

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
matrixbot
@matrixbot
Stephen D case is
Fintan Moloney
@Josebuendia
The way the cases controller is generated by the scaffold creates a variable /array called case. See: <% @cases.each do |case| %>
<tr>
<td><%= case.case_id %></td>
<td><%= case.topic %></td>
<td><%= case.created %></td>
matrixbot
@matrixbot
Stephen D ah, that's the issue then
Fintan Moloney
@Josebuendia
So, I've been going through this tutorial: https://blog.engineyard.com/using-jquery-with-rails-how-to to try to the Single page app thing sorted. But it says "parsing error, unexpected token". The code: $(document).ready(function() {
$('[data-js-hide-link]').click(function(event){
$(this).parents('li').hide();
event.preventDefault();
});
}
Looks syntactically correct to me.
Tim Krins
@timkrins
@Josebuendia in your last post you are missing the final round bracket ).
DanL12186
@DanL12186
Are you not using an IDE?
matrixbot
@matrixbot

Johan Smits > <@gitter_lorensonrails:matrix.org> Hallo everyone, I have a message error that I don't know how to resolve. I also didn't found anything useful on the internet that could help me. This is the message error that I get:

Looks like a missing require of a gem.

Johan Smits Or a the Class Stripe
Joseph A.
@matedemorphy
Is not possible to use Apartment Gem for multitenancy and ActionCable in Rails 6 yet, right?
Michael Lang
@mwlang
Are there any known issues with upgrading a Rails 4.x app from from either Ruby 2.1 or 2.2 to Ruby 2.5?
a link to relevant documentation would be highly appreciated as my Google-fu is failing me today.
DanL12186
@DanL12186
It'll depend on your code. There's always deprecations between Ruby versions, so yeah, potentially. But unlikely anything that would be a disaster. AFAIK the only real guides are for upgrading Rails versions, not Ruby...
Michael Lang
@mwlang
nice trick with bundle update --conservative. That one's new to me.
DanL12186
@DanL12186
me too ;)
Fintan Moloney
@Josebuendia

Are you not using an IDE?

I had been using Cloud9 which didn't give much info. I've downloaded the project and now its causing problems using it in VSCode. Need to change nokogiri but then I'd have to downgrade Ruby. I shouldn't have to lower my Ruby version.

William Flanagan
@wflanagan
Hey all, question. I'm trying to test my app "non-logged in" visitors. And, the problem I seem to be having, is that every request is treated like a new visitor. Seems to work fine in production. Any suggestions how to test using Minitest in a reliable way?
DanL12186
@DanL12186
people would really need to see specifics of your app/code
William Flanagan
@wflanagan
OK
William Flanagan
@wflanagan
Here's the code.. would love some feedback... https://gist.github.com/wflanagan/721de7ad59274099bf53eeb7a3e8e0ca
that has the current_helper as well the controller that renders content.
William Flanagan
@wflanagan
Nevermind. it was a "string" versus "number" problem.. thanks anyway
Joseph A.
@matedemorphy
OKD Minishift can be used like a development environment? like a Vagrant Box, let's say.
Joseph A.
@matedemorphy
or there is an alternative to Vagrant? I'm in a Windows machine and having problems to make actioncable works in a vagrant box
DanL12186
@DanL12186
This message was deleted
Tom Cardoso
@tomcardoso
Hi all, wondering if someone has a few moments to help me debug an ActiveRecord thing I'm having some issues with? I want to find an efficient way to make a slightly complex query involving database views
DanL12186
@DanL12186
Probably makes most sense to just post a screenshot with an explanation and see if anyone has any ideas
Tom Cardoso
@tomcardoso

Sure. I'm working with Textacular, which is a wrapper around pg_search. I'm using a form of multisearch using a database view, that looks at fields in two models: Case (case_number and short_title field) and CaseEvent (short_title and party_name). My database view joins the four fields into a view called Searches. Using textacular, I can do something like:

Search.web_search('richard')

=> #<ActiveRecord::Relation [#<Search searchable_id: 441, searchable_type: "Case", term: "R. v RODRIGUEZ, RICHARD">, #<Search searchable_id: 440, searchable_type: "Case", term: "R. v RODRIGUEZ, RICHARD">, #<Search searchable_id: 551, searchable_type: "Case", term: "OWIREDU, RICHARD">, #<Search searchable_id: 388, searchable_type: "Case", term: "R. v DESOUSA, RICHARD">, #<Search searchable_id: 387, searchable_type: "Case", term: "DESOUSA, RICHARD">, #<Search searchable_id: 923, searchable_type: "Case", term: "R. v KLEPACKI, RICHARD">, #<Search searchable_id: 620, searchable_type: "Case", term: "RICHARD v TREMBLAY">, #<Search searchable_id: 439, searchable_type: "Case", term: "R. v RODRIGUEZ, RICHARD">, #<Search searchable_id: 440, searchable_type: "Case", term: "RODRIGUEZ, RICHARD">, #<Search searchable_id: 802, searchable_type: "Case", term: "RICHARD, MATHIEU">, ...]>

But I want to go from that relation to a set of Cases, but still in relation form, as I'm later filtering and possibly sorting it. I can get the cases by doing:

Search.web_search('richard').preload(:searchable).to_a.map!(&:searchable)

=> [#<Case id: 621, case_number: "FC-13-00000891-0003", short_title: "ROWLAND v SPINDLER", case_type_id: 4, court_id: 1, created_at: "2020-06-02 20:45:47", updated_at: "2020-06-02 20:45:47">, #<Case id: 441, case_number: "471199820424100", short_title: "R. v RODRIGUEZ, RICHARD", case_type_id: 2, court_id: 1, created_at: "2020-06-02 20:45:37", updated_at: "2020-06-02 20:45:37">, #<Case id: 440, case_number: "47119982021900", short_title: "R. v RODRIGUEZ, RICHARD", case_type_id: 2, court_id: 1, created_at: "2020-06-02 20:45:37", updated_at: "2020-06-02 20:45:37">, #<Case id: 551, case_number: "FC-19-00000134-0000", short_title: "DE SOUSA v OWIREDU", case_type_id: 4, court_id: 1, created_at: "2020-06-02 20:45:46", updated_at: "2020-06-02 20:45:46">, #<Case id: 388, case_number: "47119982034700", short_title: "R. v DESOUSA, RICHARD", case_type_id: 2, court_id: 1, created_at: "2020-06-02 20:45:36", updated_at: "2020-06-02 20:45:36">, #<Case id: 387, case_number: "471199819808400", short_title: "R. v DESOUSA, RICHARD", case_type_id: 2, court_id: 1, created_at: "2020-06-02 20:45:36", updated_at: "2020-06-02 20:45:36">, #<Case id: 923, case_number: "211199820S208600", short_title: "R. v KLEPACKI, RICHARD", case_type_id: 2, court_id: 1, created_at: "2020-06-02 20:46:17", updated_at: "2020-06-02 20:46:17">,  etc…

But then it's an array, not a relation, which slows things down significantly (the :searchable attribute comes from Textacular itself). Is there any way to get from a Relation of Search objects to a relation of Case objects while keeping it in ActiveRecord form for possible database operations later in the same method?

DanL12186
@DanL12186
I don't think you can convert an array into an ActiveRecord Collection object
Tom Cardoso
@tomcardoso
Right, which I don't want to do anyway. I'd rather keep it in ActiveRecord
If I try to do a join I get a polymorphic error:
irb(main):122:0> Search.web_search('heather').includes(:searchable).joins(:searchable)
Traceback (most recent call last):
ActiveRecord::EagerLoadPolymorphicError (Cannot eagerly load the polymorphic association :searchable)
DanL12186
@DanL12186
Try the includes after the joins?
If this is all hyperspecific to Textaculuar/pg_search then forgive me, I've never used them
Tom Cardoso
@tomcardoso
I think it's more a polymorphism issue…
I guess I want to get from a relation of <Search> objects to a relation of its related <Case> objects instead
DanL12186
@DanL12186
oh
Tom Cardoso
@tomcardoso
So that's where I'm banging my head
DanL12186
@DanL12186
Long story short you're basically trying to get a Relation set of Parent.children from a result set of Parents, right?
Tom Cardoso
@tomcardoso
bingo
DanL12186
@DanL12186
I feel like the answer should be obvious, and yet.. lol. Maybe someone'll know.
Tom Cardoso
@tomcardoso
yeah… i've lost a day and a half to this
DanL12186
@DanL12186
Any chance it's a particular item that's failing with the includes and not all of them?
(additionally, this feels like a good time to register my grievance with the fact that it's Array#include? and ActiveRecord#include instead of Array#includes? and ActiveRecord#include...)
Tom Cardoso
@tomcardoso
i've no idea, honestly. i am super out of my depth here
DanL12186
@DanL12186
Just thought maybe you could test it with a query you know is only going to result in 1 or 2 records at a time. What the person was saying on that page was the query probably needed more information in order to eagerly load the association
My thinking may be poor, though :)
did you ever try the includes after the joins?
Tom Cardoso
@tomcardoso
i did… let me try again