Re: [Rails] http requests

2017-05-31 Thread Jason Fleetwood-Boldt
Hassan is correctly encouraging you towards the higher-level abstractions, like a Gem specifically written for this purpose. If you really want to know how to make outgoing http requests, the answer is the Net::HTTP Ruby library, which is documented here:

Re: [Rails] http requests

2017-05-31 Thread Hassan Schroeder
On Wed, May 31, 2017 at 10:39 AM, Joe Guerra wrote: > How about passing the parameters in the url? and opening up the canada post > site with that? You can certainly do that, if one of the gems doesn't meet your needs. Have you read the Canada Post API docs? -- Hassan

Re: [Rails] http requests

2017-05-31 Thread Joe Guerra
Ok, I'll try the gem. How about passing the parameters in the url? and opening up the canada post site with that? Thanks, Joe On Wednesday, May 31, 2017 at 1:36:20 PM UTC-4, Hassan Schroeder wrote: > > On Wed, May 31, 2017 at 10:27 AM, Joe Guerra > wrote: > > Hmm,

Re: [Rails] http requests

2017-05-31 Thread Hassan Schroeder
On Wed, May 31, 2017 at 10:27 AM, Joe Guerra wrote: > Hmm, which gem would allow you to perform http requests within Rails? I > would like to send a request to the canadapost website and pass it some > parameters and return a shipping total. > > I do believe there is a

[Rails] http requests

2017-05-31 Thread Joe Guerra
Hmm, which gem would allow you to perform http requests within Rails? I would like to send a request to the canadapost website and pass it some parameters and return a shipping total. I do believe there is a canadapost gem, but I'm not sure how upto date it is. I guess the other option is to

Re: [Rails] rails 4.2 query with operator in

2017-05-31 Thread João Bordalo
First of all, thank you for your quick reply!!! The relation is a bit complex: in the investment's model there is this relation: belongs_to :project, :class_name => "Baseline", :foreign_key => :baseline_id this is the relation between investment and project Em quarta-feira, 31 de maio de 2017

Re: [Rails] collection_select

2017-05-31 Thread Walter Lee Davis
What is the relationship between a club and a press release? Does a club have many press releases? Start with the real-world relationship, then add that relationship to your Rails models. The answer will suggest itself. Walter > On May 30, 2017, at 10:57 PM, fugee ohu

Re: [Rails] rails 4.2 query with operator in

2017-05-31 Thread Marco Antonio Almeida
Hi João, The problem is that you don't have a field called 'projects.id' in the 'investments' table. Does your investment model *belongs to one* project? Then you would do Investment.revenues .where(project_id: @projects.map { |p| p.id }) .includes(:expenses, baseline: [:project,

[Rails] rails 4.2 query with operator in

2017-05-31 Thread João Bordalo
Hi, there. I'm trying to solve a problem that previously worked on rails 3.2 and isn't in rails 4.2: The query is the following: Investment.revenues .where('projects.id IN (?)', @projects.map { |p| p.id }) .includes(:expenses, :baseline => [:project, :coordinator]).