Most voted "ruby" questions
Ruby is a dynamic, interpreted, object-oriented, cross-platform, open-source language created by Yukihiro Matsumoto (Matz) in 1995. The [ruby] tag is for issues related to the Ruby language, including its syntax and its libraries. Specific questions about the Ruby on Rails structure should be marked with [ruby-on-Rails] and not [ruby].
Learn more…679 questions
Sort by count of
-
1
votes2
answers74
viewsFATAL failed to allocate memory
Good afternoon, I’m using the Gem Rb-libsvm: https://rubygems.org/gems/rb-libsvm/versions/1.3.1 In order to generate a template for tweeting (positive/negative). From a database with 19000 positive…
rubyasked 9 years, 6 months ago Pedro Luiz Tortella 57 -
1
votes0
answers29
viewsProblem deploying with Pistrane
I am having a very strange problem with Pistrano at the time of deploying to my staging environment. I am using Ruby 2.0.0, Rails 4.2.3 and Capistrano 3.4.0. My server environment is ready, however…
-
1
votes1
answer186
viewsSaving information in bank and sending via post in Rails
I have a view that explains a system and allows the user to send content for publication. It just type in a textarea and this text is sent to a WP blog, along with your username and email, which…
-
1
votes1
answer292
viewsRuby on Rails - Insert a render into an html tag
How do I add a render inside an HTML tag? For example, this works okay: <%= render :partial => "feed/new_card", :locals => { :main_image => image_tag('feed/new_badge.jpg') } %>…
-
1
votes2
answers775
viewsGenerate random numbers
I have the following problem: I need to generate a random number between 1 and 6 Assign to a array of numbers if this new number is not contained in array If contained, generate again. Do this…
-
1
votes1
answer241
viewsUndefined method `chomp' for nil:Nilclass
Good night to you all. I’m learning Ruby and I’ve stumbled upon this error in the code I’m creating and I can’t go on or find the error. Can anyone tell me where the error is? ( I’m trying but by…
-
1
votes1
answer1256
viewsCompile css with Sass on Windows
I installed ruby in windows and installed Sass. According to the tutorial, I have to monitor the css file until then beauty, but I wanted to edit a css file that already exists, and not a new, how…
-
1
votes1
answer54
viewsFix HTML of a page using Ruby/Nokogiri
I’m having a little difficulty consuming an HTML generated by a third party page, where HTML is missing some closing tags. For example: <div> <li> <div> <div>test test…
rubyasked 9 years, 4 months ago Luiz Carvalho 3,644 -
1
votes2
answers245
viewsCreate New Reporitory - Git / Bitbucket. Git (Could not read from remote Repository)
I’m doing the Ruby on Rails tutorial and I’m catching on to a problem. I’ve already made a repository hello_app (cap a), and now I’m trying to do the toy_app (cap two). This is the step by step…
-
1
votes1
answer45
viewsError setting up Ruby on Rails environment
Good afternoon, you guys I am learning Ruby on Rails in college and to practice at home I am trying to install and configure the environment on my pc, but without success. I installed Netbeans and…
-
1
votes2
answers629
viewsSplit by upper case letters
How can I use the split to separate the words in the sentence "QueroSepararAsPalavrasNestaSentença" in Ruby?
rubyasked 8 years, 9 months ago Carlos Antunes 11 -
1
votes1
answer2231
viewsHow to subtract two dates using Ruby and the Time library?
That is the code: require 'time' t = Time.parse('2016-04-18') #data de ontém t2 = Time.now #data atual t3 = t2 - t # subtração das duas variáveis(datas) acima puts Time.at(t3) #resultado da…
-
1
votes1
answer224
viewsUpdate on Rails 4 using :has_many :through many relationship for many (has_and_belongs_to_many)
I’m having a question about how to update Rails 4 using :has_many :through, if there is a more correct and easier way, I am open to suggestions. Error: app/views/Articles/_form.html.erb…
-
1
votes1
answer163
viewsAdmin View Ruby on Rails
Next I created a website using Ruby on Rails and the Gems Devise and Pundit. Users have a role who may be an Analyst, Developer or Administrator. I’m wearing a View to list all registered users for…
-
1
votes1
answer407
viewsHow to nest step Definitions within another using Cucumber
I would like you to help me solve this doubt, I’m trying to reference a step definition inside another in the same file to avoid repeating code, of course if this is possible. Example Dado /^escolho…
-
1
votes3
answers1008
viewsPrint variables in Ruby
How to print two variables on the same line (without skipping)? I’ve tried print instead of puts but it didn’t work.
-
1
votes1
answer108
viewsNomethoderror in Usuario#new Rubyonrails
controller: class UsuarioController < ApplicationController def index @usuarios = Usuario.order :nome end def new @usuario = Usuario.new end def show @usuario = Usuario.find(params[:id]) end def…
-
1
votes1
answer515
viewsGroup hashes by Ruby value and manipulate them
I have this hashed array that I’ve simplified to get smaller. My goal is to join by marca of carros to make a small report showing how much that marca is making a profit based on compras. Notice…
-
1
votes2
answers426
viewsExtract a new array from an array - Ruby
I have the following exit: => [ [ 0] [ [0] "CELULA", [1] "LENNA ", [4] "jul 01", [5] " 2015 12:00:00 AM", [6] "N", ], [ 1] [ [0] "CELULA", [1] "ARI [4] "jul 01", [5] " 2015 12:00:00 AM", [6] "P",…
-
1
votes2
answers174
viewsHow to send commands to the ruby interpreter from a Shell Script?
This is more out of curiosity... I’ve seen some examples of what I want to do, but in Perl. I tried to find a way to do the same in Ruby, but to no avail. I want a function to generate an MD5 hash…
-
1
votes2
answers78
viewsBecause stop["value"] is returning nothing
I’m creating a project in Ruby on Rails, where I create a shout with the following route in Postman: POST:http://localhost:3000/api/yells { "user_id":"1", "title":"caneca", "desciption":"beber",…
-
1
votes1
answer137
viewsJust create the relationship too much for many in Ruby
I have a very long-standing relationship with Yell and Category entities: model Yell.Rb class Yell < ActiveRecord::Base belongs_to :user, inverse_of: :yells has_and_belongs_to_many :categories…
-
1
votes2
answers1124
viewsHow to rewrite correctly on Nginx?
I’m having trouble setting up Nginx as a reverse proxy in an application. It’s a Rails application that runs on Unicorn. In case, I have the mastery http://www.meudominio.com.br. Instead of creating…
-
1
votes1
answer185
viewsAutocomplete Rails 4 + jQuery
Good afternoon, you guys! I have the following scenario below: a model city where all the cities in Brazil are already registered, and I have a view Companies where I will register the companies and…
-
1
votes1
answer82
viewsRuby on Rails - .html.erb file does not update on the server
I modified the show.html.erb file, but the changes are not displayed on the system, I started to work with Ruby in Redmine a little while ago, it could be cache or some compilation is needed in the…
-
1
votes1
answer196
viewsHow to run shell script to restart server by application
I need to run a shell from Rails with a small difference, I need the script to continue running even if the server(puma) process is killed. I added an update system inside my application, but I need…
-
1
votes2
answers349
viewsselect_collection on Ruby on Rails
If I want to return the options of Active and Inactive so that I select, I use the following code in the view, then it returns the 2 status: <%= select(:student, :status, Situation.all.collect {…
-
1
votes0
answers233
viewsHow to get the value of a field from another table with ruby on Rails
Hello, the question is this: I have classes that use data from other classes, I need you to load the values registered in these other classes, show this in an html page. This is the structure of a…
-
1
votes1
answer76
viewsForce SSL on Rails
Let’s say you use the browser to interact with the computer camera or notebook in some way. This will only happen through an SSL connection, as browsers reject permission to access the camera if not…
-
1
votes0
answers69
viewsNew fields added after scaffold do not persist in the bank even though they are in Strong params
I have a little problem here that I haven’t been able to solve for 3 days. Very strange. It’s in the editing of a record. He’s just updating the first record, not the second. The curious thing is…
-
1
votes1
answer54
viewsPerform searches using repetitions
I created the following method to fetch random people from a certain party, the problem is that if I want to add ten more people from another party it does not add, only replaces the search without…
-
1
votes1
answer38
viewsPlace an iterator in a table in a .pdf.erb file
I have a table where there is a list of people wanted to put a counter to stand a number next to each item on the list: kind of: 1-Maria. Segue arquivo financial.pdf.erb``<tbody> <%…
-
1
votes2
answers992
viewsHow to update Gem in windows?
My problem is I can’t update gem I lowered the rubyInstaller tried running command to update: gem update rails --no-document But unfortunately no update gives error: gem update rails --no-document…
-
1
votes1
answer86
viewsRegister two separate models in one
Today I come with another question, but about code. Next, I am making a system to register students and courses and a screen to register classes where part of the registration is to select students…
-
1
votes1
answer108
viewsError installing rvm switches
This error occurs for the two things I tried: 1 - install ruby and from there install rvm Requirements. Error running 'requirements_debian_libs_install gawk libreadline6-dev libyaml-dev sqlite3…
rubyasked 8 years, 9 months ago noob-rails 127 -
1
votes1
answer365
viewsrequire command does not work on Gem for ruby
I installed the Ruby, the Railsinstaller and the Rubydevkit no on partition C (e.g. c: Ruby23-x64). Execution in cmd ruby -v appears the version of ruby installed smoothly. Executed Gem install…
-
1
votes0
answers43
viewsI cannot install ruby 2.3.2 on Centos without root privilege
I need to install ruby on a server with Centos 6.5. I don’t have root access, so I can’t use yum. I downloaded the source file, unzipped it into a folder called ~/software and rode ./configure…
-
1
votes1
answer75
viewsRun ruby script in C
The error code when running the script in ruby. file.Rb: #!/usr/bin/env ruby x=1 while x<10 puts "It Work!" x+=1 end main. c: #include <ruby-2.0.0/ruby.h> int main(int argc, char **argv){…
-
1
votes2
answers89
viewsWhy only save the last record in the table?
Guys, a little help here, please! <%= form_tag(portabilizar_portabilidades_path, name: 'form', method: :get) do %> <table class="table table-condensed table-bordered table-hover">…
-
1
votes2
answers176
viewsHow to select record by position
can you tell me how I can select a record by position? How would you search for Maria’s record? Obs: do not search by id or name I found the take in the guide, but it looks for the first and the…
-
1
votes1
answer148
viewsUse database data for authentication
I have a database with existing data, with name, CPF, RG and other personal data. I need to implement a login system, but I wanted the user to be in case the registration number and password CPF,…
-
1
votes1
answer52
viewsWhen using puts exits only the address, and not the expected message
Hello, I’m starting with the ruby language and I find the following problem that is at the time of printing message through to_s: main class require File.expand_path("lib/Livro") biblioteca = []…
-
1
votes3
answers1980
viewsHow to find a letter in a string?
How can I test if a letter (stored in a variable) is contained in a word? ex: palavra = "palavra" escolha = "a" output The word has 3 letters "a" in the word.... or…
-
1
votes1
answer89
viewsWhy some methods have ' :: '
Why some methods like Perl or Ruby: Net::FTP, has these two points; how is the construction of the methods of this class and why is created in this way (with this syntax) and not in the way used by…
-
1
votes1
answer95
viewsRails rspec, post error :create, params require
I’m starting rspec tests on Rubyonrails and I’m having a problem testing my controller’s create: it "creates lançamento" do post :create, params: attributes_for(:lancamento), format: :js, xhr: true…
-
1
votes3
answers295
viewsDisplay fields from a hash in the view
I have a result of a variable that receives the output of an sql from postgres. I need to iterate it in a view and I don’t know how to display the specified fields. In products_controller I have:…
-
1
votes0
answers296
viewsAuthentication using Token With Devise Rails
Staff need help implementing authentication by token, I already created the models, the application is working properly, now I need to improve security. The customer will send me registration and a…
-
1
votes1
answer85
viewsRuby and PHP in the same VPS
I’m considering the idea of hiring a VPS at Linode to host different projects. The point is that some of them are in PHP and others in Rails. My question is: It is possible to configure a VPS to run…
-
1
votes2
answers177
viewsFailed to insert Gem mysql in Linux Manjaro
It’s been a while since I started playing with Ruby on Rails on Ubuntu and created some little projects. I currently installed the distro Manjaro and installed ruby and Rails and I want to run my…
-
1
votes0
answers151
viewsCreate new user in the database via Rails C
Help me where the error is occurring, because I am not able to identify pq the field is not being recognized. Rails c u = User.new(email:'[email protected]', registration:192536, password:'changeme',…