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
-
1
votes1
answer214
viewsDifferent Model type objects mapped from a single table
It is possible to map from a single table of the database different objects of type Model with Activerecord in a Ruby on Rails project? Suppose I have in the database a table with the name customers…
-
1
votes1
answer41
viewsWisper as an alternative to the Observer Design Pattern on Rubyonrails
I’m trying to implement the Wisper as an alternative to the Observer Design Pattern that was discontinued from Ruby. The error is: Wrong number of Arguments (Given 1, expected 0) The method I…
ruby-on-railsasked 8 years, 1 month ago Emanoel Lopes 31 -
1
votes0
answers374
viewsNFS-e signature problem - Shipment tampered after signing
I am developing the issuance of NFS-e to the city of Gaspar-SC via web service, in which uses the company Thema for banknote processing. I’m having trouble signing the NFS-e where is returning the…
-
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
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
votes2
answers55
viewsHow to compare hash coming from JSON on RAILS
Personal created a web service that today receives a registration and a password, it makes a select in the database and compares see if the registration and password are equal, if yes it shows some…
-
1
votes0
answers40
viewsCapistrano always overrides config/Routes.Rb for the standard Rails code
Good morning guys! I have the following problem: Every time I run cap production deploy, Capistrano wrote the Routes.Rb with the standard Rails code. Rails.application.routes.draw do # For details…
ruby-on-railsasked 8 years, 2 months ago junioregis 111 -
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
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
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',…
-
1
votes0
answers161
viewsSearch for nested json Rails files
I have some files that are services, organs, units. The agencies have services and units. I, in the jsons I have, can return to the part where, for example: localhost/api/organs/.json. that it…
-
1
votes1
answer84
viewsRelationship Through Many-To-Many Activerecord
I have the following configuration in Rails: Company has_many :company_products has_many :products, :through => :company_products Product has_many :company_products has_many :companies, :through…
-
1
votes0
answers51
viewsrqrcode_png Rails controller - Passing the string contained in the database by parameter
How do I pass the value that is in the field "codigo" of table "mesas" to the space Below "VALOR_STRING_BANCO"? How do I pass the value found in the field "codigo" table "mesas" into the space below…
-
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
answer48
viewsI would like to create an object equal to a query in the database
I would like to create an object with the fields equal to the query of Activerecord, however, with the fields pre-filled or blank, so that they are called in the same way in the other file... To…
-
1
votes1
answer329
viewsHow could I add an ICONE inside a SELECT in HAML
Hello, I would like to add icons (from source, like bootstrap for example) inside a select field in HAML, at first I am doing so, would that be possible? I thought about using the bootstrap…
-
1
votes0
answers30
viewsSort Activeadmin Index by Boolean
In suggestion.Rb I have the following code: index title: "Sugestões" do column "Título", :title column "Autor", :user column "Aprovado", :published actions end The last column :Published is of the…
ruby-on-railsasked 7 years, 10 months ago Jhonatan Petronilho 95 -
1
votes2
answers679
viewsRename column with Rails using Migration
I created a Migration to rename a column and only get the error; Undefined method `to_sym' for nil:Nilclass == 20161001182840 RenameColumnPasswordInUsersPasswordToPasswordDigest: migrating --…
-
1
votes0
answers39
viewsHow to play Gem Audited logs on Logstash
What is the best way to play the logs from gem Audited (Rails to the Logstash ? To Gem Audited: https://github.com/collectiveidea/audited/…
ruby-on-railsasked 7 years, 10 months ago Vitor Nascimento 126 -
1
votes1
answer240
viewserror handling, Rails 4
This error happens when the user does not select the option from the select field. The error would even be dealt with if it had not Collect: NoMethodError in Subdisciplinas#create Showing…
-
1
votes1
answer103
viewsRuby on Rails, form_for with 3 levels
I am trying to create comment, through the form_for of 3 levels: Article > Item > Comment Controller: def new @comment = Comment.new end I have tried several ways, and they all fail. Look what…
ruby-on-railsasked 8 years ago Moisesello 41 -
1
votes2
answers421
viewsHow to send form_tag variables to javascript function? Rails
I am new to web programming and Rails and have the following question: I have a view that displays a food list and a field to fill with the amount of grams I want from each food. I’d like to exhibit…
-
1
votes0
answers34
viewsHow do I set up controller tests to use requests?
After creating a controller a test for the controller is automatically created. You can disable this test creation for the controller using the code below: Rails.application.config.generators do |g|…
-
1
votes1
answer1463
viewsHow to authenticate an Oauth 2 connection to Postman?
My API uses in the backend Rails 5 to Gem devise_token_auth (omniauth) for authentication. The frontend is using ng-token-auth (Angular 1.x). I have all API requests on Postman. I did the security…
-
1
votes1
answer116
viewsHow to add globally allowed parameters in Rails?
In several Sources I use address, I decided to allocate logic in Concerns. A need is to add the allowed address parameters, see below the Concern that should add permission to address_attributes:…
ruby-on-railsasked 7 years, 10 months ago Bruno Wego 1,568 -
1
votes1
answer837
viewsWhat is the right way to implement filters in Rails?
Good morning! Currently, I have an application with a simple CRUD, and I am creating a new view to display the records. In this view, I’m including some filters that are links with parameters to be…
-
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
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
votes0
answers74
viewsHow to make a local variable an instance variable for an ERB template with Binding?
Below I exemplify my need in a code where I need to redefine variables such as @dispute = dispute so that they are instance variables and the template loaded by ERB can access them through the…
-
1
votes1
answer222
viewsUse custom css (Rails and windows)
Good afternoon, I’m a beginner in Rails and I’m trying to put in the project the frontend I have here from another site. HTML, css and javascript are all ready. Then I managed a controller with the…
ruby-on-railsasked 7 years, 9 months ago churros 191 -
1
votes0
answers203
viewsCompound name in template does not generate plural in table name
I would like to ask a question further to this post: How to program in Portuguese in Ruby on Rails? I started studying Rails has little time and I’m going through a problem with pluralization. When…
ruby-on-railsasked 7 years, 9 months ago churros 191 -
1
votes1
answer70
viewsIs there a need to declare the same dependency in Gemfile and gemspec?
I have several Engines in my API, all have as a dependency Artemis::Core. I want to understand the difference between declaring Gemfile, for example Gem artemis-core: source 'https://rubygems.org'…
-
1
votes1
answer66
viewsRuby on Rails web server problem
I type the command Rails server he makes that mistake here; why didn’t he know the web server?…
ruby-on-railsasked 7 years, 6 months ago wladyband 4,694 -
1
votes3
answers817
viewsHow to simplify the translation call on i18n?
See this example below of a missing translation: { "errors": [ "Email translation missing: pt-BR.activerecord.errors.models.artemis/user.attributes.email.taken" ] } To solve this translation I must…
ruby-on-railsasked 7 years, 8 months ago Bruno Wego 1,568 -
1
votes1
answer105
viewsroute problems in ruby on Rails
in the file Routes Rails.application.routes.draw do root 'pages#home' get 'about', to: 'pages#about' # For details on the DSL available within this file, see…
ruby-on-railsasked 7 years, 6 months ago wladyband 4,694 -
1
votes1
answer1373
viewsText area with image
Hi, I’m going to make a form and I don’t know how to include an image within the text area, something like that. TEXT TEXT IMAGE TEXT Something to include user know? How is done here in stack…
-
1
votes1
answer345
viewsMetaprogramming with ruby, methods with SELF
good evening... I come from other languages somewhat different to Ruby, such as C/C++ , JAVA... And I got a little lost trying to understand the difference between the following methods: Class teste…
-
1
votes3
answers146
viewsViews specifies for Devise
In my project I am using the Rails 5.1.1 and the Devise for login. My question is how I can make a View ,so that the Devise uses as layout, without being the application.html.erb?…
-
1
votes1
answer64
viewsRails - Undefined Method 'client' for 'Book'
Hello, I’m working with ruby on Rails and I’m having the error: 'Undefined method', as in the image The employee is working, and if I put only the book.cliente_id, it works. Follow the codes below:…
-
1
votes1
answer103
viewsCheck records for the same month
I’m having trouble searching the sqlite3 database, records for a specific month, I searched the internet but I couldn’t find anything that could help me. I have an Account template that has…
-
1
votes2
answers904
viewsAdd new fields in Migration ?
Hello I am working with Ruby On Rails, and for platform authentication I am using Gem 'Devise'. I came across a situation where I need to add new fields for user registration (Birthday date, gender,…
-
1
votes1
answer75
viewsCoffeescript on Rails - select items from a table
Hello! I have the following code generated by Scaffold: <p id="notice"><%= notice %></p> <h1>Produtos</h1> <table class="table table-striped" id="tabelaProdutos">…
-
1
votes1
answer21
viewsRspec - Feature test failing because elements are not rendered in test execution
I have a test Feature failing because the moment it runs some HTML elements (<li data-podcast>) not yet rendered. Does anyone know how to fix it? RSpec.describe 'Podcasts List', type: :feature…
-
1
votes1
answer188
viewsIs it mandatory to use belongs_to in Activerecord?
It is mandatory that in order to have an association between two models, I have belongs_to and has_one? Or it is possible to use only has_one/has_many between the two models, when not necessarily…
-
1
votes1
answer1100
viewsColumn-specific selection in an HTML table in JS
Hi! I’m an IT student and I’m learning about Rails. I have the following HTML table of a view: <p id="notice"><%= notice %></p> <h1>Produtos</h1> <table class="table…
-
1
votes2
answers47
viewsNull return of an object in the controller - RAILS
Hello! I have the following code snippet from a controller called Productoscontroller: def index @produtos = Produto.all end def gerarlog @produtos.each do |produto| File.open('produtosBD.yml', 'a')…
-
1
votes0
answers210
viewsHow to filter active client list in a given period
Good morning everyone. I am developing a management software for a home care company. I have a list of clients who may be active or inactive within a month. Each customer has a contract value with…
-
1
votes2
answers73
viewsRegistration in the form that repeats every month
I’m developing an app on Rails to control expenses and personal income. I wanted, in the form, when registering an expense, the user to mark a checkbox (it is listed in the expense table as…
ruby-on-railsasked 7 years, 2 months ago Willy 7 -
1
votes1
answer2430
viewsRails 5 validate CPF
Hello, I’m a beginner in Ror. I have a form with field for CPF and need to validate whether it is valid or not before saving the record. I tried different Gems like: Gem'cpf_cnpj', Gem 'brcpfcnpj'…