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
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
answer49
viewsProblem with validates in Rails 4
I have a situation I can’t understand what’s wrong. I have a validation in the model that the console works correctly, but when running through the browser the form does Submit and ignores the…
-
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
answer22
viewsAssign ID at time of creation
Guys, I’m starting with Rails and I got a question. I need to assign the ID of a "father" when creating your "children". For example, a blog has_many Posts. The moment you click the create post…
ruby-on-railsasked 7 years, 12 months ago Emília Parsons 131 -
0
votes0
answers228
viewsWhy is the timestamp field in the Firebird database displayed differently in a Ruby on Rails application?
I have a database Firebird 2.5 legacy. Access it via IBExpert 2016.9.4.1 This database is part of a request management system that is being migrated from an application Delphi 10.1 Update 2 for an…
-
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
votes1
answer357
viewsAuthentication and user permission
Hello. I am setting up a system for registration and update, it would work as follows User logs in and receives a screen to edit their own registration, only. But I’m having a doubt. As I’m new at…
ruby-on-railsasked 7 years, 11 months ago Kirk 1 -
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
answer45
viewsCustom id on form button
I have a button to send a form <div class="actions"> <%= f.submit, html: {class: "button"}%> </div> But none of the HTML attributes (class and id) work, just cause me error on the…
ruby-on-railsasked 7 years, 11 months ago Kirk 139 -
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
answer39
viewsHow do I enable Rails to support multiple open connections to the data cluster?
I use Postgresql in my API and if my GUI (Navicat) is open accessing the application database and try to run the command db:drop db:create db:migrate db:seed get the error below:…
-
0
votes1
answer92
viewsHow to remove upload files after the db:drop command in Rails?
My API uses the Gem shrine to effect several different types of uploads. Unfortunately during development the files are accumulating in the folder public/uploads every time I do db:drop of the…
ruby-on-railsasked 7 years, 10 months ago Bruno Wego 1,568 -
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…
-
0
votes1
answer69
viewsCounting records updated by day Rails
How do I count up-to-date records in Rails? Next I have to receive this data in array format to pass and convert into json. I have table A which has many of Table B Through A I have to count how…
ruby-on-railsasked 7 years, 9 months ago André Gava 262 -
0
votes0
answers12
viewsHow to resolve issues related to loading modules/classes that are still in memory?
Round and a half my Sidekiq gets the error shown below, and soon after is played again to run queue. After a while, the error automatically disappears and the queue continues to run normally.…
ruby-on-railsasked 7 years, 9 months ago Bruno Wego 1,568 -
0
votes2
answers147
viewsWhere’s my mistake in this Ruby code?
I’m having trouble in methods with passing parameter, the code runs, but it moves when I pass var within one method and receives as parameter in another. I’m new to Ruby. def player_welcome puts…
-
0
votes1
answer67
viewsApplication based on multiple authorization profiles
I have a handful of doubts in an interesting scenario, I hope you can give me a little help. I am using in an angular application the package ng-token-auth for authentication, for permissions…
-
0
votes1
answer44
viewsHow to get md5 from a record and check if it is unique?
I have an atypical need where several records are imported by lot, these records have no unique identifiers, each record has information about a debt. I am imagining creating an md5 of each record…
ruby-on-railsasked 7 years, 9 months ago Bruno Wego 1,568 -
0
votes2
answers57
viewsHow to return data from the i18n translated api?
My API returns serialized data with active_model_serializers, some of these attributes are translated into frontend using angular-translate. The dictionary containing the translations is increasing,…
ruby-on-railsasked 7 years, 9 months ago Bruno Wego 1,568 -
0
votes1
answer130
viewsRails and simple_form, filter values to fill a combobox
There are three tables, one call enterprise, another group and a call subgroup, there is a field loan in this two, the last has the field group_id, a form, in this form use the simple_form to show a…
-
0
votes1
answer37
viewsRails 4.2.6 error authenticate method
I am trying to use the authenticate method and the Rails returns Nomethoderror: Undefined method `authenticate' for #. My controller: class Sessionscontroller < Applicationcontroller #include…
-
0
votes0
answers27
viewsHow to serialize an object generated by Factorygirl?
I have an object user generated by FactoryGirl like the below: FactoryGirl.define do factory :user do name { FFaker::NameBR.name } image { FFaker::Avatar.image } email { FFaker::Internet.email }…
-
0
votes2
answers187
viewsCounter on model
I’m looking for a way to add an incremented variable to the id of a div, could someone tell me the most recommended way to do this? my difficulty in making this increment is due to the Cocoon that…
-
0
votes1
answer53
viewsEmployee research, multiformulary or single form?
I am developing an app that should be made available to employees of a particular company, so that co-workers themselves make the evaluation of one (two, three, etc.) working friends by answering…
-
0
votes2
answers134
viewsError starting HTTP server in Ruby
Hello guys I’m new with Ruby and I’m trying to create my first project but when I will start the server with the command rails server i get this mistake: João@joao-note MINGW64…
-
0
votes1
answer24
viewsHow do eager_load with nesting controllers?
In the index method of the controller Disputes::ConferencesController list all the conferences of disputes. The URL address is disputes/1/conferences. My route schema is like this: resources…
ruby-on-railsasked 7 years, 10 months ago Bruno Wego 1,568 -
0
votes1
answer47
viewsHow to return the correct Location to route with Resources in the singular?
When using the controller name in the singular, the path is prefixed with _index at the end of the route name (ex. dispute_conference_index). Inside the controller in the method create the parameter…
ruby-on-railsasked 7 years, 10 months ago Bruno Wego 1,568 -
0
votes1
answer50
viewsProblem with Tinymce Rails
I am creating an application with Rails and made the integration of the Tinymce editor by Gem The installation process went smoothly. I tested it on the local server and it worked the first time.…
-
0
votes1
answer604
viewsUndefined method `id' for nil:Nilclass
I’m a beginner in Ruby, and I made this mistake... def new @section = Section.new({:page_id => @page.id, :name => "Default"}) @pages = @page.subject.pages.sorted @section_count = Section.count…
-
0
votes1
answer624
viewsAim to catch logged in user
Guys I have a simple application using ruby on Rails a Gem Rails admin and Devise to authenticate i have a model called task where every task belongs to a user , so I would like to pick the user who…
-
0
votes1
answer35
viewsbelongs_to association inside serializer is not returning anything
The application contains a module called Dispute, this module contains Procedures, each Procedure contains a user and belongs to a dispute. As described below, belongs_to is not displayed and the…
-
0
votes1
answer94
viewsHow to return the complete object from an associative table?
The code below returns only the ID’s of their respective relationships, need that instead of returning user_id and role_id return the object user and role with the registration data. Take a look at…
-
0
votes0
answers43
viewsSet a field in all models
I’m trying to create an app that works with several companies and I always need to record the field company_id whenever creating and/or updating any model, what’s the best way to do this? I thought…
-
0
votes1
answer131
viewsError installing Rails on Linux Mint
While running sudo Gem install Rails, I received this error message: Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem native…
-
0
votes1
answer49
viewsRails 4 - Has_many problems
I need help displaying in the view the value in the view of a relationship with has_many. I have my product model: class Product < ActiveRecord::Base paginates_per 15 has_many :product_images,…
-
0
votes2
answers204
viewsopen modal with link_to
Well, I’ve never done and I’ve searched a lot of sites and I can’t find anything that does what I need. I need to make a modal appear from a link_to, the person when clicking on the link_to opens…
-
0
votes2
answers335
viewsRails + Materialize Select field
Diplomats, I have the following problem: <div class="input-field"> <%= f.label :kind_id %> <%= collection_select(:contact, :kind_id, @kind_options_for_select, :id, :description,…
-
0
votes2
answers238
viewsColor transition effect in the navbar of a bootstrap template in Rails
Hello, I am using a template of startbootstrap, the Agency, I was able to import it to the Rails project, I put the theme in the vendor folder, I imported the scss in Aplication.scss and I put the…
-
0
votes2
answers356
viewsRead TXT file on Rails
I have an application in Ruby on Rails and I need to read a particular file txt which will be sent by the user. After sending the file, the file data will be displayed to the user so that it…
-
0
votes1
answer191
viewsIs Gems Ruby or On Rails?
I’m starting in Ruby and On Rails. I got a little confused about "Gem", it’s part of Ruby or On Rails? Example of command below. gem install nome gema
-
0
votes1
answer230
viewsHow to save data from another model. To archive information
I have two models: employees and reports. Every month some information about employees changes while others remain the same. I want to create reports with the information month by month. So if you…
ruby-on-railsasked 7 years, 6 months ago Peterson Fonseca 21 -
0
votes1
answer89
viewsActive record, how to replace Uniq with distinct correctly?
I’m trying to recover the months where I have answers to a survey this way: Answers.pluck('EXTRACT(MONTH FROM created_at)').uniq (0.7ms) SELECT EXTRACT(MONTH FROM created_at) FROM `answers` =>…
-
0
votes1
answer36
viewsDevise - "Brush" system tasks per user
I’m making a simple little application where the user can delete, edit, view and create tasks, tasks have description, title and date to be executed. I have implemented Aim to register users and…
-
0
votes1
answer97
viewsNested Translation wrong Inflection
Opa, The problem is this: I have a model called Idea and I’m trying to add a new nested in it to Ideategoria which is an associative with Idea. So we have: Idea: has_many :ideia_categories,…
-
0
votes1
answer965
viewsBackground overlay
On my site I have an animation that is a train track and a train that runs along this same track, but now I wanted to overlap with a backdrop image, which would be tunnels, and that was positioned…