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
-
2
votes1
answer334
viewsNomethoderror in Home#index
Next, I received a challenge to create a page with login, using Sign in and with the user logged in, that he could create a task list, an to-do list. The login I managed to do and works well,…
-
2
votes1
answer302
viewsWhat does a "Join table" mean?
I was reading the book Beginning Rails 4, when I came across messe excerpt on page 100. Let’s get back to the Relationship between users and comments. You need to Tell your user model that a user…
-
2
votes1
answer99
viewsProblem with Ruby Gem Chartkick
After the change to daylight time I’m encountering a problem with the Gem Chartkick. I rode my query as follows: Ticket.unscoped.where('created_at >= ? ', Time.now -…
-
2
votes1
answer334
viewsHow to create code to license monthly my customers?
I need to make a code for license to use, for example: My customers pay monthly for use of our system, but these customers have the application installed locally in their companies. I need it…
-
2
votes2
answers624
viewsInitializing instance variables in Activerecord
I’m having difficulty initializing instance variables in Rails, I need to use a variable in several methods, but this needs to be initialized beforehand, for example: class Test <…
-
2
votes0
answers60
viewsHow to configure schema_search_path in the test environment?
When I run the rake spec --trace command I have the error below. It seems to me that rake does not create the schema I want in the test environment by not identifying my schema configuration in…
-
2
votes0
answers125
viewsHow to create a Mock in Ruby On Rails (Carrierwave) to simulate sending an image to a S3 (Cloudinary)
I created a project creation system with image. My images are uploaded to Cloudinary + Carrierwave. Before the Test did not break because I sent to the server, but when I integrated in Cloudinary…
-
2
votes1
answer78
viewsRender a layout across multiple sites
I have the following situation, I have several sites with different layouts and databases, but I wanted them to use the same administrative area, the same Gems, because if I need to fix a bug in the…
-
2
votes1
answer70
viewsRails Generator for nested Resources
was researching but did not find any Generator to nested Resources in Rails. Would anyone know me if you know any?
ruby-on-railsasked 9 years, 8 months ago Henrique Cardoso 198 -
2
votes2
answers490
viewsAdding more fields to the user table with Gem Devise
I wonder if there is possibility to add more fields to the user table generated by Devise because I need to relate it to others, and add more information. Is there a problem in doing so?
-
2
votes1
answer58
viewsHow to add more lines to a Ruby class?
I began to venture into the world of rubygems. I’m developing a Gem to generate my twitter bootstrap-style app’s Assets, as I intend to reuse my front-end code. All I need to do is put the Assets in…
-
2
votes1
answer236
viewsRoutes in ruby on Rails
I have the following routes: resources :roles do resources :role_permissions do patch 'toggle_action/:id' => 'role_permissions#toggle_action' end end I create a link as follows:…
ruby-on-railsasked 9 years, 7 months ago Daniel 1,222 -
2
votes2
answers153
viewsQueries with various ruby associations on Rails
I want to do in ruby on Rails, this: SELECT * FROM isolateds INNER JOIN genes ON geness.isolated_id = isolateds.id INNER JOIN stats ON stats.gene_id = genes.id INNER JOIN mutations ON…
-
2
votes2
answers190
viewsRails Console does not load the methods and classes of my application, why?
I have a model called Person, when I open the Rails Console and try to assign it to any variable, I get this: user.localapp (test) $ rails c Loading development environment (Rails 4.2.0) (Ruby…
-
2
votes1
answer210
viewsProblem creating Rails application
Whenever I’m going to create an application, when doing a scaffold (following tutorials) I get the following error: C:\Users\User\Usuarios>rails generate scaffold Usuario nome:string…
-
2
votes1
answer303
viewsHow to make an ajax request that returns an html text?
Assuming the link making the request is: <%= link_to 'New Classroom', new_classroom_path,class: :remote_link, remote: true %> And may the treatment of the return of the same be:…
-
2
votes1
answer397
viewsWhich files should be inserted into . gitignore in a Rails project?
I’m starting in Git and also in Ruby on Rails. I created a new project using rails new myapp -d mysql and added to my Github repository. When creating the project Rails generates multiple files. So…
-
2
votes1
answer240
viewsHow to run Javascript function on the Current page through the Application Controller?
I’m doing a browser validation (IE < 10) through the Application Controller with the gem "browser". I need any application page that is accessed to run a Javascript function with a message saying…
-
2
votes1
answer85
viewsRuby on Rails and Javascript
I have the following in the controller on Ruby on Rails: def index @categorias = Categoria.find(:all) end In my View I have the following code to get the categories: <script…
-
2
votes0
answers85
viewsSubdomain accessing only specific features with Rails
I’m using Rails 4.2.2 I have the following code in the config/Routes.Rb file: Rails.application.routes.draw do namespace :api, constraints: { subdomain: 'api' }, path: '/' do resources :users end…
-
2
votes1
answer689
viewsQuery using "select" and "joins" with activerecord in Rails 4
I need to make a report and I have the following query: Deducao.joins(:prestador) .select('pessoas.razao_social, pessoas.qtd_min_mensal, count(deducoes.id)') .group('deducoes.prestador_id')…
-
2
votes1
answer41
viewsDelete a flash[:Success] a few seconds after being shown to the user?
I have a registration form using Rails, where after the user completes the registration, it is redirected to the login page along with a flash[:success] that shows a welcome message. My doubt is…
-
2
votes1
answer381
viewsDoubt about using send() in ruby
The general idea of OO is that each object can react in a different way to the same message. In ruby, I noticed that it is possible to use the send() method and that every Ruby object has this…
-
2
votes1
answer81
viewsI can’t convert Rails app from sqlite to postgres (to deploy Heroku)
I’ve been trying to convert a rails app in sqlite for postgres in order to use it on Heroku, following this tutorial from Heroku himself: https://devcenter.heroku.com/articles/sqlite3 Only when I’m…
-
2
votes1
answer68
viewsCould not find Gem byebug (> = 0) in Ruby on Rails
When I execute the command rails server, the following message appears to me:: Could not find Gem byebug (> = 0) This is in Windows. I tried using a gem install byebug but it doesn’t work and…
-
2
votes1
answer261
viewsjQuery UI autocomplete only works once
I am working on a functionality of a Rails application where we use a Gem call Best in Place, which provides the possibility of inline editing of model attributes. But there was a need to use jQuery…
javascript jquery ruby-on-rails jquery-ui jquery-pluginsasked 8 years, 11 months ago Pedro Vinícius 1,870 -
2
votes2
answers75
viewsWhat is the best way to create a model q has a field that is an integer Enum?
What is the best way to create a model q has a field that is an integer Enum ? ex:Rails g model status ( do not know how to inform that it is an Enum nor the data type)
-
2
votes1
answer96
viewsEntity architecture in Rails
I am in doubt about how it would be the best way to represent an entity named client that may have sub-layers of the same entity. Customer may own another Customer who is actually a carrier, and…
ruby-on-railsasked 8 years, 10 months ago FernandoLopes 307 -
2
votes2
answers144
viewsHow to edit and create new record in DB? Ruby on Rails
I would like to know how I can make the following situation. I have 2 models Custo and Custo_Historico all the CRUD is already working. Only when I want to edit a cost it must always create a new…
-
2
votes1
answer40
viewsPage cache is not expiring
I am using the caches_page in a controller in my application in Rails 4. caches_page :index, expires_in: 10.minutes I need to have this controller run again after 10 minutes and generate a new page.…
-
2
votes1
answer79
viewsNested Attributes Rails Child model not saved
Good afternoon! I’m having a problem with storing models with nested Attributes. In the app, we have Customer, which has 1.. n Contacts, which in turn has 1.. n Telephones. I researched a lot before…
-
2
votes1
answer88
viewsMysql, acess denied for user, using password: no
When creating a new project in Rails using mysql rails new exemplo -d mysql and then rake db:create I have the following error Acess denied for user 'root@localhost' (using password: NO) Please…
-
2
votes2
answers514
viewsNested Attributes with Rails
I’m developing a system for study, which will allow the creation of a user. This user, in turn, will have an inventory, which will have several items. My question is how to save all these resources…
-
2
votes1
answer120
viewsRails 4 Error each_with_index when using activerecord-import
I’m trying to import an app into Rails 4 using Gem activerecord-import. When I try to execute the command: Detail.import( columns, values, :validate => false ,:timestamps => false ) I get a…
-
2
votes1
answer52
viewsTesting with rspec - problems with stub and should
Hello. I am new to testing and have two tests with problems, one of helper and one of model, being: 1) TodosHelper TodosHelper#visibility(todo) when todo is public Failure/Error: before {…
-
2
votes1
answer54
viewsSearch for random objects using conditions
I want to seek for example 10 random people of the same party I did as follows, but this selecting people from all parties, what can be done? = D class Pessoa < ActiveRecord::Base class <<…
-
2
votes2
answers218
viewsAdd new field to the bank with Rails
I inserted a new column in my table contents and also includes the field in the form with the same column name in the creation table (client_id), but this data is not entered when I create a new…
-
2
votes1
answer101
viewsHow to change an attribute in the bank via a button
I’m creating a small college project in Ruby on Rails and I came across a problem: I have a table called Person and another call Tools. People have many tools and every tool and owned by one person.…
-
2
votes1
answer410
viewsRun Rails commands on the Ubuntu terminal
I’m learning Ruby through an Alura course and I have a question. Every time I want to execute a Rails command, for example startar the server with the command rails server the following error occurs…
-
2
votes3
answers122
viewsView related data during Iteration
I created a relationship between the models client and content and I can access their data using the console normally. con = Content.find(1) con.client.name # Nome do cliente But when I try to…
ruby-on-railsasked 8 years, 1 month ago RFL 6,205 -
2
votes4
answers1978
viewsMask in Rails fields
Guys I’m getting beat up for something theoretically simple, I’m wanting to put a date mask on my application.js: //= require maskedinput jQuery(function($){ $("#datadoacao").mask("99/99/9999");…
-
2
votes1
answer36
viewsIncorrect return
Good evening, I’m having a problem pulling the bank information and display in the show. my code is like this: <%= @question.answers.each do |answer| %> <div class="media"> <div…
ruby-on-railsasked 8 years, 3 months ago Oracy Martos 193 -
2
votes1
answer122
viewsCreating a Ruby Commitment Schedule
I want to create a kind of routine that Intercale time interval Example: 8:00 to 12:00 with 30 Minutes interval A sample of the code class Appointment < ActiveRecord::Base has_many :schedules def…
-
2
votes1
answer817
viewsHow do I make the relationship many for many in Ruby on Rails with has and belongs to Many?
I have a table system and a table category, a system has many categories and a category has several systems, I wanted to use the has_and_belongs_to_many option of Rails (for being a simple relation…
-
2
votes1
answer401
viewsHow to run the puma server with SSL in development?
My Rails 5 application uses Webrtc, and Webrtc (camera, etc) only works with SSL enabled. I use a local SSL server. What are the correct procedures to implement and enable SSL support on the puma…
-
2
votes1
answer118
viewsAccess level and hierarchy when checking checkboxes
Speak up, all right? Can you help me with something? I’ll explain: I enter the admin user and it shows all system permissions. As an example, suppose you have 10 (index, show, create, update, delete…
-
2
votes1
answer2041
viewsHEROKU connect to mysql database
I’m doing reverse engineering on a system, and what I want is to use the same database as the old system. But I am not able to connect the system database in production with this base. And because…
-
2
votes1
answer87
viewsHow to force a nested route to use the same parent route parameter name?
My route scheme needs to add 3 new routes to custom actions in my controller: start, Cancel and Finish. resources :disputes do scope module: :dispute, except: :index do resources :conference,…
ruby-on-railsasked 7 years, 10 months ago Bruno Wego 1,568 -
2
votes1
answer123
viewsCreate a list of ruby on Rails features
I’ve been trying for a few days but I haven’t been able to solve my problem. I need to create a list of features for an item and then list them all. I wish you could help me or give me some tutorial…
-
2
votes1
answer788
viewsRedirect to another action from another controller in Rails
I am developing a simple action, when saving a register if there is value in a given field the system should redirect to a create from another model/controller. I’m having trouble making this happen…