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
-
0
votes0
answers22
viewsRails does not install in Centos
I have a VPS with Centos running, and I can’t get out of this mistake: [athos@athoscastro bin]$ gem install rails Fetching: nokogiri-1.6.6.2.gem (100%) Building native extensions. This could take a…
-
0
votes1
answer248
viewsUpdate a website to a newer version of Rails
How to upgrade a website developed in Ruby on Rails to a newer version of Rails? For example from 4.2.4 to a possible Rails 5.0.0. I’m still beginner in the language and framework and I was left…
-
0
votes1
answer32
viewsRuby - How to hit LOAD_PATH at development time?
First: I’m a newcomer to Ruby. I have a Ruby project that obeys the design pattern of the vast majority of projects. Therefore, the main executable is in bin/. bin/exec lib/ | -- library.rb --…
-
0
votes2
answers126
viewsError Undefined method `sign_in_as! '
I’m making the following mistake: Failure/Error: sign_in_as!(user) Nomethoderror: Undefined method `sign_in_as! ' for Someone could help me! I’ve added the module, but nothing! I’m very grateful to…
rubyasked 9 years, 6 months ago Rodolfo Peixoto 31 -
0
votes4
answers1365
viewsFind out the type of variable in ruby on Rails
I have a form in search Rails that can receive a zip code or the name of a street, so I need to know what type of variable the user is entering, if it is numbers, I do a search by zip code, if it is…
-
0
votes1
answer113
viewsRails 4 + -jquery-datatable + ajax-datatable - Http and Actioncontroller error 406:Unknownformat format json
I was studying Rails and following the tutorial https://github.com/antillas21/ajax-datatables-rails. The tutorial steps were the following, create a datatable that would perform a request via json,…
-
0
votes1
answer827
viewsGem::Loaderror Specified 'mysql2' for database Adapter, but the Gem is not Loaded. Add `Gem 'mysql2'` to your Gemfile
This error appears constantly, in my case I installed ruby, Gems, Rails, mysql2 all right. But when I tried: rake db:create another error appeared: Gem::Loaderror: Specified 'mysql2' for database…
-
0
votes1
answer260
viewsProblem loading data from a table with Angularjs and Rails api
The code of my front-end : var listaDeProdutos = function(){ $http.get("http://localhost:3000/produtos").success(function(data,status){ $scope.listaProdutos = data; }).error(function(data,status){…
-
0
votes1
answer170
viewsUpdate stock before saving template with nested_attributes and Gem Cocoon
Friends, I have a form that uses nested_attributes and I use Gem Cocoon. I have 3 models involved. Variation Containing Stock, Order, Containing Order and Parent of Detail Containing Order Detail.…
-
0
votes1
answer52
viewsI would like to connect Rails to Intel xdk
My ultimate goal is to create an xdk app that interacts with Rails. If nobody knows exactly how it works but give a light on how to access the sqlite with ruby and javascript already helps a lot. I…
-
0
votes1
answer47
viewscheck if method in backend is true and client too
I have a code that in my backend it returns true or false, I am working with ruby and Rails 5. then I have la an if more or less so ja: <% if @order? %> <h2> teste 2 <h2>…
-
0
votes1
answer104
viewsrake aborted! Ruby on Rails, Wordpress Plugin
I had to enter the world of Ruby the force to modify a Wordpress plugin, I’m new to Ruby, only followed tips and I can not manage to solve the problem. Following the steps to do this I find myself…
-
0
votes1
answer67
viewsParameters Action Mailer with Bluehost Brazil
Hello, I am trying to send notifications in my Rails application, in development mode. With GMAIL, everything ok, but I’m not able to use with the hosting I have at Bluehost Brasil. I have tried to…
-
0
votes1
answer89
viewsConsultation on the Activerecord
I have this relationship . How do I consult on ActiveRecord to return data from Works, WorkZei and Wi_schools? I tried so: r = Responsible.find(1) students = r.students students.each {|s|…
-
0
votes1
answer155
viewsError executing a Rake Task
I need to perform some custom tasks, but whenever I try, I get the following message: Application has been already initialized. I searched several places, including the OS in English, but without…
-
0
votes1
answer57
viewsError trying to install ruby Gosu library (OS X)
I’m trying to install Ruby’s Gosu library with the command sudo gem install gosu, but it returns the following error message: ERROR: Error installing gosu: ERROR: Failed to build gem native…
-
0
votes1
answer27
viewsAdd all Select Box solver groups
I have a Select Box with some solver groups and a button to add them to the bank. By clicking the button, I add the solver group to the bank. But this is done one at a time. I would like to do this…
-
0
votes1
answer67
viewsPerformance problem when returning json with rabl after query with activerecord
I’m having trouble adjusting performance when returning json after a database query. I’ve tried a lot of things, and I’m not getting any faster. Someone can give me a boost with this ? This is the…
-
0
votes1
answer115
viewsFill in an Association from another - ruby on Rails
I have an application for scheduling services and I’m not able to preempt a selectbox from the selection made in another. Explaining better: I have a selectbox with the services available and when I…
-
0
votes1
answer62
viewsNested Objects has_one Rails 4
Fala galera, I’m new to Rails and I’m trying to make a crud with two objects , a Project and another Album. Project has_one Album , as a test each one has only one :name as parameter , but I cannot…
-
0
votes2
answers654
viewsRuby error after updating Ubuntu
After updating Ubuntu, it no longer loads Ruby or something like that, the error message that returns is: /usr/bin/env: "ruby2.1": File or directory not found Every time I have to start the…
-
0
votes2
answers69
viewsGem not available
Error: Cound not find Gem 'jquery-Rails (>= 0) ruby' in the Gems available on this machine Imagery: I’m using a virtual box, this could be it?…
-
0
votes3
answers122
viewsHow to install rvm in Debian
I’m trying to install the RVM but I’m not getting it. When checking the dependencies it complains about the package libgmp-dev that is not installed and when trying to install it is not located.…
-
0
votes1
answer34
viewsHow to disable a select associaition from simple form
I have a select Association of the simple form, the value of it passed via controler and I wish that in the form the user did not have the option to select another value. I have tried using…
-
0
votes1
answer489
viewsError not detected by Cucumber test
I am using the version of Gem Aruba 0.13.0 and Cucumber 2.x. x would like to know how to detect the following error using a Ruba step Definition. More specifically if Exit status was successful and…
-
0
votes2
answers256
viewsRails and Mysql - Data Types
I started using Ruby on Rails recently for a project, and have doubts about scaffolding and other DB features present in Rails. Here’s a topic explaining data types in Active Record Migration…
-
0
votes1
answer63
viewsHow to upload file via ajax with Rails 4?
I want to transfer a pdf file to process on my controller and then return it while it is being processed on backend, I would like a slider or click circle to appear. However, I am having trouble…
-
0
votes2
answers398
viewsWhy not create a Ruby on Rails distribution that works well on Windows?
Okay, to put it bluntly, how to have a Ruby On Rails development environment that works well in Windows OS? I already tried to install the newest version Rails 5 by the prompt, but whenever I create…
-
0
votes2
answers280
viewsList random objects
How could I generate random cars in the following model? it would be better to do this in controller? class Pessoa < ActiveRecord::Base has_many :carros end…
-
0
votes1
answer197
viewsMysql Connector problem in Rails
Talk personal, I’m not getting create a database for my Rails application it informs the following message : Error C: Ruby21-x64 Devkit Project>rake db:create DL is deprecated, Please use Fiddle…
-
0
votes2
answers75
viewsHow to pass an Array to the IN clause of a flat query?
I am using Activerecord to run queries in several different databases. In one of the queries, I have to do the following: publications_to_read = [1,2,3,4]…
-
0
votes1
answer47
viewsDoubt about creating "repeated" methods in Rails
Person, I started to use Rails a little while ago and I have a question of how to improve the code below: I have a model called User that has an attribute called Role for permissions. However, to be…
-
0
votes1
answer68
viewsLargest palindrome product - Ruby
How to make this code faster? It works, but not fast enough. #!/bin/ruby def isPalin(mul) if mul.to_s == mul.to_s.reverse then return true else return false end end def lp(n) arr = [] for a1 in…
-
0
votes1
answer26
viewsUpdate_all Rails with own database field
I need to make a change to all the database columns by replicating the information from another column, for example: Model.update_all("a = b") I would like to create threads and start running, for…
-
0
votes1
answer33
viewsError while using rhc
I’m getting an error when I try to use the $ rhc setup, I can not understand why of the mistake, someone can tell me why of the same and how to resolve it kindly? an excerpt that says it has not…
-
0
votes1
answer75
viewsField select duplicating with Chosen-Rails and relationship has Many through
Personal talk, I have a GROUP_TV table and it relates to the City table through has Many through. In the _from.html.erb view of GROUP_TV, I have a collection_select to select as many cities as I…
-
0
votes1
answer34
viewsRemote error: true using in RAILS, to POST a JS file
I have a problem with my code, I want Rails to do remote: true of "Login" with a class and an id as below, but the server passes a GET, but I want to search the controller for the format.js to send…
-
0
votes1
answer30
viewsConstant charging
I’m having trouble with the model report. Console: LoadError (Unable to autoload constant Report_questao, expected app/models/report.rb to define it): app/controllers/pessoas_controller.rb:49:in…
-
0
votes1
answer38
viewsHow to redirect to the same object position after update
I am displaying a collection of random objects in my index action. However the objects are displayed one at a time. So: @objects = Object.order("RANDOM()").limit(1) In the index view, I can send a…
-
0
votes1
answer113
viewsQuery with select and find in Rails
Hello, I wanted to make a find with select of only a few fields in Rails, but it is giving error, however, if I do with Where it works normally, does anyone know if it is possible to use select with…
-
0
votes1
answer279
viewsNameserve: Undefined method `send_data' for Clonedatabase:Class
Rails does not find method send_data clone_database.rb require 'zip' class CloneDatabase < ApplicationController def self.make_clone zip_data = 'a'.to_json send_data zip_data, type:…
-
0
votes0
answers115
viewsTake the value of a select_tag and put it into a variable
I want to take the value of this select_tag and put it in the link_to message <%= select_tag(:testee, options_for_select(CloneDatabaseController.find_all_models)) %> <%= link_to('Click…
-
0
votes1
answer45
viewsRegular expression for zip file
How to add a zip file instead of an image? class UploadDatabase < ActiveRecord::Base has_attached_file :zip_file, styles: { medium: "300x300>", thumb: "100x100>" }, default_url:…
-
0
votes1
answer47
viewsMultiple Joins with Active record returning null
Friends, I have the following exits from the console (Rails 4.1): Product.all Product Load (0.2ms) SELECT "products".* FROM "products" => #<ActiveRecord::Relation [#<Product id: 4, cod:…
-
0
votes1
answer73
viewsFunction reference in Ruby Array
I couldn’t understand what the Ruby relation of the reference of an array variable is like (best and vector) with the return of a function (fitness or bitstring for example). Consider the next case:…
-
0
votes1
answer104
viewsRuby on Rails, how to improve the performance of the Hash to Activerecord transformation?
I am having a performance problem when transforming a hash for the activerecord model objects, the hash is returned by Gem Savon after consuming a web service. Benckmark has a relatively high time…
-
0
votes1
answer88
viewsHow to do a data migration routine?
Suppose I have a registration model and a user model. How do I get each registration record sent to the users? This should also be done to each new record that is created in the register, it should…
-
0
votes1
answer330
viewsProblem with nested form has_many through using dynamic form
I have the following problem in a form using has_many through. I have a register where I created dynamic forms. These dynamic forms are inserted in another screen. I’m having difficulty in the…
-
0
votes1
answer47
viewsBcrypt - Automating password encryption process
Hello. I already have a column in my database called password. Use Password for authentication, so he created another column called encypted_password. Even if I copy all the password values and play…
-
0
votes1
answer264
viewsProblems running the Rails server with Vagrant
I created a Xenial Xerus 64x box with Vagrant, installed rvm with Rails. I am running the server in the VM quiet, I can access there by VM the Rails server running, but I cannot access from my local…