Most voted "ruby-on-rails" questions
Ruby on Rails is an open source web development framework written in Ruby. Allows the developer to write source code following the MVC model and is known for its "convention on configuration" approach to application development.
Learn more…779 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
answer94
viewsDeploy Ruby on Rails with Capistrano
When executing the deploy I have the following error: Rack app error: #<RuntimeError: Missing 'secret_token' and 'secret_key_bas' for 'production' environment, set these values in…
-
0
votes1
answer48
viewsForm Many to Many Rails
I’d like to know how to make one form Many to Many in Rails. Here are my models: class Course < ActiveRecord::Base has_and_belongs_to_many :notices, dependent: :destroy has_and_belongs_to_many…
ruby-on-railsasked 9 years, 2 months ago Vinícius Venancio dos Santos 329 -
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
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
answer107
viewsRails routing error - uninitialized Constant
Guys, I created an application in Rails and managed some models, controllers etc. As follows: rails g scaffold nivelIntermediario/Historia descricao:string My route file looked like this: namespace…
-
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
votes2
answers64
viewsError giving puts of a variable within the DEF
Hello. I can’t print variable that is inside a def. Script class Logparser def initialize(ip, data, code) log = File.open("/project/log_sec/log/log.txt").each do |file| parse = file.split(" ") data…
-
0
votes3
answers601
viewsMandatory fields depending on the form
need to specify what will be mandatory depending on which form is displayed. I have a Model that has some Ex fields.: //Model User :name, age, address: In Create for User, only :name must be…
ruby-on-railsasked 8 years, 12 months ago Carlos Fagiani Jr 160 -
0
votes2
answers166
viewserror giving the command rake db:create in summer Rails 4.0.0
Well, I’m starting on Ruby on Rails, I’d like to understand the following error when generating the command rake db:create so I can solve it.…
ruby-on-railsasked 9 years ago Nabucodonosor 1 -
0
votes2
answers91
viewsValidation of has_and_belongs_to_many in Ruby on Rails
I have the following models: class Pedido < ActiveRecord::Base has_and_belongs_to_many :produtos validate :has_one_or_less_produtos private def has_one_or_less_produtos errors.add(:produtos, 'Não…
-
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
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
answer272
viewsRuby on Rails - Randomize JSON variable and apply in Array
Guys, I’m having a problem that’s relatively simple, but it’s killing me. I have an array of JSON objects. This array of objects will compose another array of containing other n arrays. So far so…
-
0
votes1
answer129
viewsProblem creating Ruby on Rails
I am trying to put an entity I already had in my project as Sign in to login and etc, I used the following commands add in Gemfile the line gem 'devise' in the terminal executed: rails generate…
-
0
votes2
answers155
viewsStoring data in a Rails array
I need to store data coming from a database search in an array, but with the code below it only stores a value in the array. @busca= Item.find(:all,:conditions=>{:codigo=>params[:codigo]})…
-
0
votes0
answers114
viewsGoogle Oauth + Globe.com stopped working
No customer with email @globo.com is more able to access my services via Oauth. In the old days, they all signed in to "Login with Google", typed in the credentials of the globe.com, and logged in…
-
0
votes2
answers571
viewsSort array in Rails
I cannot sort my array in descending id order. <%@vendas = Vendas.find(:all,:order=>"id, DESC")%>
-
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
answer265
viewsHow to edit the simple_form to customize the fields
I would like to know how to edit the fields of Forms with simple_form, edit such with bootstrap, I read some tutorials but I did not understand well how to edit, how to use the class: form-control,…
-
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
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
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
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
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
votes0
answers336
viewsexample of iugu checkout for Rails does not work
I’m trying to make this example of yugu work: https://iugu.com/referencias/exemplo-de-checkout I have an account in iugu in test mode. I followed the steps of this tutorial, made the necessary…
-
0
votes1
answer74
viewsSelect ruby complex on Rails
I have a model that describes the friendship between my users: #CreateFriendship.rb class CreateFriendships < ActiveRecord::Migration def change create_table :friendships do |t| t.integer…
-
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
votes0
answers40
viewsf. label is overwriting the information that is in f.text_field
<div class="input-field col s12"> <%= f.label "Número do SUS" %> <%=f.text_field :sus_number %> </div> <div class="input-field col s12"> <%= f.label "Paciente"%>…
-
0
votes0
answers196
viewsUpdate fields using jquery and Gem Cocoon
I’m using the Rails Cocoon for child form creation. When creating the child form, a field called Barcode is read and, via ajax, I receive the product information and fill in the form fields. This is…
-
0
votes1
answer296
viewsRails Assets error. Javascript not working correctly (Datepicker)
I’m willing to add the bootstrap-datepicker to my project. I did it this way. Gemfile: source 'https://rails-assets.org' do gem 'font-awesome-sass', '~> 4.5.0' gem 'rails-assets-bootstrap-sass',…
-
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
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
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
votes1
answer112
viewsBundler Error::Gemrequireerror
When I try to launch the Rails server, it appears that someone knows how to proceed? Erro (Bundler::GemRequireError…
ruby-on-railsasked 8 years, 7 months ago Gabriel Rodrigues 1 -
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
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
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
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
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
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
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
votes0
answers51
viewsJS only works by updating the page
Click on the button: <td><%= link_to 'simulacao', simulacao_path(simulado) %></td> on the simulation/id page there is another button that requires js, but it only works if I update…
-
0
votes2
answers78
viewsHow to register a new Person when you create a new Customer
po I am with a question already a while breaking the head, next, I have a model Person, which is the Generica for person and the model Customer, which belongs to Person, so: class Person <…
-
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
votes2
answers56
viewsHow do you consume custom routes with Ember?
My Rails api has the user/me route that returns the current user data, written like this: #routes resources :usuarios do get :mim, on: :collection end #controller def mim render json: usuario_atual…
-
0
votes1
answer272
viewsSelect state city rails4
I have a dynamic select of states and cities and my idea is to list the state capital selected first. I have the following code to list the cities but not listing the capital first: @cidades =…
-
0
votes1
answer33
viewsSaving father and son if both are valid in Rails
I have two classes Protocolo and Movimentacoes, in the rescue of Protocolo I create a new Movimentação. class Protocolo < ActiveRecord::Base has_many :movimentacoes after_create…
ruby-on-railsasked 8 years, 3 months ago Luiz Carvalho 3,644