Questions tagged as 'ruby-on-rails'

0
answers

upload pdf ruby on rails

I am in need of uploading pdf files to the system made in ruby on rails. I can do this with the images however with pdf files I can not. I'm using carriwave. report_uploader.rb class ReportUploader < CarrierWave::Uploader::Ba...
asked by 04.04.2018 / 20:51
0
answers

How to call a method in the view that returns a pdf to the user?

I created a small script to consume my API, in Ruby. require 'http' data = response = HTTP.get("http://localhost:9292/api/boleto", :params => {:type => 'pdf', :bank => 'blabla', :data=> '{...}'}) puts response.body # retorna um...
asked by 06.04.2018 / 16:20
0
answers

Change the render when clicking on a specific div

I have in my Rails application the following code: .col-md-6 h2.h2-move Imagem hr .col-md-6 h2 Lista hr = render 'listings/list_of_listing', listings: @listings, message: 'Você não gerencia anúncios no momento.', load_more_path: req...
asked by 02.04.2018 / 21:47
1
answer

Error editing record in DB

Hello, I'm having problems with editar a record: Follow View _form.html.erb <%= form_with(model: cliente, local: true) do |form| %> <% if cliente.errors.any? %> <div id="error_explanation"> <h2&g...
asked by 28.03.2018 / 21:59
1
answer

Join data from two tables by foreign key - Rails ActiveRecord

Hello, I have a Model Comment which is a belongs_to of User , and a Model Profile that is also a belongs_to of User . I can easily access User data through Comment.first.user , for example, but I'd like to acce...
asked by 26.03.2018 / 04:44
0
answers

How to check if a featured news item already exists in a Rails Department

I'm creating a news app in Rails and it has a carousel that shows the news stories highlighted. Each department has a place to show this prominence. I would like to know how to make an alert appear as soon as the "Featured News" checkbox is sele...
asked by 19.03.2018 / 00:25
0
answers

String insert in Ruby for JS

How can I make the code below in Ruby for JS. (3...value_size).step(3) { |num| value.insert(value_size - num, separator) } For step I think of this loop for (var i = 3; i < value_size; i += 3) , but for the .insert...
asked by 20.03.2018 / 02:33
0
answers

Questions about javascript in rails

I would like to know some points about rails: When I am in a completed post view and I resolve to leave it, how do I post an alert warning that I can lose these changes? Is it possible to display a deleted post, or is it possible to insert...
asked by 13.03.2018 / 15:10
0
answers

Hibernate should mount query only with the required joins

I have list with createCriteria on it I have several ifs to query only the parameters queried on the form, however, the hibernete by default at the time of the query assembly joins all tables that have constraints: select *from volume this_...
asked by 07.03.2018 / 21:13
0
answers

rails 5.1 simple form

I am trying to put a mask on my simple form initially, I tried it as follows :input_html => {:maxlength => 14, :"data-mask" => "999.999.999-99"} It did not work so I tried :data => {:mask=> '999-999-9999'} That also di...
asked by 07.03.2018 / 20:44