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
-
3
votes1
answer491
viewsWhat is the difference between Controller and Helper methods?
Architectural and conceptual doubt: I own a model Item who possessed attributes nome_ptbr and nome_en. I did the following method: def display_nome nome_ptbr || nome_en end Where should I put these…
-
3
votes3
answers216
viewsIs it wiser to use client-side validations in Rails?
According to your own experience it is best to use validations on client-side? Because if we analyze, Rails, in the standard validations, sends the request, does the validation and then returns the…
-
3
votes1
answer884
viewsError: incompatible Character encodings: UTF-8 and ASCII-8BIT
Incompatible Character encodings: UTF-8 and ASCII-8BIT. {"utf8"=>"✓", "authenticity_token"=>"3cl0R8ghLDvPMGkh0I+LCrzQjmyu1donLE9y58rIT1k=", "post"=>{"title"=>"Somos apaixonados por…
-
3
votes1
answer173
viewsStatistics in Ruby on Rails
I have the following problem, I need my system to generate some statistical data from an array, for example: vetor = [1, 5, 2, 1, 6, 30, 2, 7, 2, 80] I need to extract some data from it, like:…
-
3
votes1
answer3217
viewsHow to prevent a simple query from traversing the entire Mysql database
I have an application in Rails that uses a Mysql database with a table with millions of rows. Sometimes it happens that some part of my application does a very heavy query, locking all the rest of…
-
3
votes1
answer233
viewsUML Questions for Rails System
My question is this. Rails controllers, for basic CRUD operations, require various methods that are repeated throughout the application’s controllers. I’m drawing the diagrams for a TCC application…
-
3
votes2
answers500
viewsOrganize jQuery Ruby On Rails
I have an app in Rails 4 and after scaffolding it generates a *.js.coffee for each model, as I am not using coffeescript renamed to *.js and am trying to use jQuery. The problem is that I need to…
-
3
votes2
answers729
viewsEncrypt source code Ruby on Rails?
I need to deploy a ready-made system made with the framework Ruby on Rails in a client’s company, the problem is that this client cannot have access to the source codes. Is there any way to…
-
3
votes1
answer113
viewsusing console
Starting project with Vagrant, when using the console, appears a message of 'Unable to load Pry' see below full: $ rails c Loading development environment (Rails 4.1.4) => Unable to load pry…
ruby-on-railsasked 10 years, 2 months ago Thiago Humble 93 -
3
votes2
answers263
viewsRails and postgres group_by data considering time zone
How do I group records by date where the field is datetime type? But that’s considering Timezone. For example: When the user type 12/10/2014 23:30:00, it is recorded in the bank 13/10/2014 01:30:00,…
-
3
votes1
answer155
viewsMigration to Heroku
I’m migrating my DB app pro Heroku, the deploy worked: $ git push heroku master When trying to migrate the database according to the command $ heroku run rake db:migrate does not work and returns…
-
3
votes2
answers1396
viewsHow to organize css and js?
I bought a free template and am applying on my main blog page. I created an admin for this blog and I’m wondering if my Assets organization is correct. Follow the structure: app/Assets/Avascripts:…
ruby-on-railsasked 9 years, 9 months ago Thiago Porto 292 -
3
votes1
answer120
viewsAdd Time by converting to Ruby for seconds
I am trying to find the average difference between the creation date and the last update of the records of a table as follows: tickets = Ticket.all.where('updated_at IS NOT NULL') t =…
-
3
votes2
answers86
viewsFetch the various fields from the query
I have this darling: @tudo = Isolated.joins("LEFT JOIN resists ON resists.isolated_id = isolateds.id").joins("LEFT JOIN genes ON genes.isolated_id = isolateds.id LEFT JOIN stats ON stats.gene_id =…
-
3
votes2
answers1232
viewsEnable CORS in api Rails
They’re using this one GEM to enable the CORS of my application. The code I have in my config/application.rb is as follows: config.middleware.insert_before 0, 'Rack::Cors' do allow do origins…
-
3
votes2
answers1397
viewsHow to disable a combobox with a condition in jquery?
I’m working on a project in Rails, where in a view of the project I own several combobox, where at first I would like only one to be enabled, and according to the value selected the others are…
-
3
votes1
answer532
viewsHow to render a partials structure from another directory in Rails?
1) Structure of views Assuming I have two sets of views, the set A and the set B. Both sets are similar possessing the view index.html.erb and the partials _index.html.erb, _new.html.erb,…
-
3
votes4
answers396
viewsSelect without id field (Ror)
I am with a very silly doubt, I am making a system with Ruby on Rails and I need to make a select where the id field does not come, the problem is that this field is always present, for example:…
-
3
votes2
answers249
viewsTruncate text and do not show unwanted characters with Rails
I’m using the function truncate to show part of a text, next to this function I added the function html_safe so that the text does not display unwanted characters. But when the text is greater than…
ruby-on-railsasked 8 years, 6 months ago Carlos André 145 -
3
votes1
answer563
viewsSidekiq rails in production
I’m trying to put and produce an APP that uses Redis and Sidekiq to queue up. In development it works as follows. I run the command on the terminal: bundle exec sidekiq -q default I’ll keep it…
-
3
votes1
answer88
viewsInfluence of ":" in Ruby
The Framework data validation parameters Ruby on Rails, use values with : before and after the word. validates :terms_of_service, acceptance: { accept: true, message: 'Mensagem de Validação' }…
-
3
votes1
answer126
viewsMultiple submits calling multiple methods in a single form
Hello! I have a form that contains two buttons, each button, when clicking, leads me to a different method within the same controller. How do I do what I need to do? Because I’m not getting it. form…
-
3
votes2
answers155
viewsRails performing XHR request when loading pages
I have noticed that in every page/route exchange, the Rails *make a new request Ajax to search for this new data (HTML), and thus perform the page exchange. I did several searches but the closest I…
-
3
votes1
answer35
viewsstore the formatted value of my created_at date in the ID
I have one question: A column called shoe_id on my table, I’d like that id is automatically generated when I register a product, and I would also like it to be in the format without dividers from…
-
3
votes1
answer300
viewsSumming values of a column of a Ruby-related entity
I am trying to build an application in Rails. I have a resource where the user registers products and sales. The relationship is too much for many, to pass an array of products for sales made of the…
-
3
votes1
answer157
viewsCreate an object with strong Ruby on Rails parameters
I need to create an object from only one button. I pass nothing to the method, I call only through the button. All the data I need I have access to the controller action I’m using. But I can not…
-
3
votes3
answers262
viewsMany to Many JSON POST - Rails 5 - Only API
Hello, I am developing an engine in Rails 5 where it will be just a blog API. It will be a simple system. Post has several Passions and Passions has several Posts. I made the relationship N…
-
3
votes2
answers495
viewsSeparate a column of the database in two and take the values of users already created
I have a table of users in the database with a column NAME, but it will be necessary to separate between NAME and SURNAME. My question is: will users already created in the bank have to be edited…
-
3
votes2
answers144
viewshas_many through association [RAILS 3.2]
I’m having trouble with an association has_many, through on a project I’m working on. In case I need to model a relation that adds the attribute order to relation table. To try to model the…
-
2
votes3
answers847
viewsCorrect model test (Rspec)
I created a test to validate my model and I want to know if it is correct. describe Article do it "object article create is valid?" do article = Article.create article.title = "Title for Test"…
-
2
votes1
answer297
viewsRegister a Devise "User" through Seeds.Rb
I’m finishing a project and want to create a default user. The entire user registration structure is carried out by the Developer embedded in rails_admin. Through search I found this syntax below…
-
2
votes3
answers128
viewsNomethoderror in Users#show
I’m learning Rails, following a book that has the following code: Usercontroller class UsersController < ApplicationController def new @user = User.new end def edit @user = User.find(params[:id])…
-
2
votes1
answer223
viewsError running continuous integration test - Travis-CI
For learning purposes I am using the services of Travis-CI to carry out the integration tests continues on a personal project. When running the test locally all pass, no errors. However, when…
-
2
votes1
answer415
viewsInstallation template wrapbootstrap
I bought the Genius Bootstrap template and had a problem using it with Rails. I have taken the following steps: I created a new app( Rails new experiment) [ Rails 3.2.13] I moved the contents of the…
-
2
votes1
answer114
viewsHow to add a link in the Redmine menu only for logged in users?
I created a link, at the top of Redmine, for a certain sector of the company. I need to know how to hide this link if there is no logged in user. The button was created in the init.Rb file of my…
-
2
votes2
answers157
viewsInitializing the Redmine
I have a little problem initializing my Redmine in the environment. After all Mysql configuration etc... when I use the command to start the application I get the message: ArgumentError (A secret is…
-
2
votes1
answer1243
viewsHow to route with optional and ordered parameters in Rails 4?
How I make a route like this? site.com/clothing/men/T-Shirts_type/Nike_brand/100-500_price/Red,White,Blue_color/ site.com/clothing/woman/Nike_brand/100-500_price/Red,White,Blue_color/ It should…
-
2
votes3
answers579
viewsDelete . bashrc, . bash_profile and . profile files: what are the consequences?
I’ve been trying to install the Ruby and the Ruby on Rails through the RVM but during the installation process I had some problems. I tried to uninstall the RVM through the commands : rvm implode…
-
2
votes1
answer984
viewsHow to send daily email?
I have an application in Ruby on Rails that I need to send a daily email. I thought to use the own class Mailer of rails. What I do not know is if it is possible to check the time to perform…
-
2
votes1
answer116
viewsCreating Scaffold’s for plugins in Redmine
How do I create a Scaffold in a plugin redmine?
-
2
votes2
answers121
viewsRuby and Ruby on Rails version - Openshift
I tried to upload an application made in Ruby 2 and Ror 4 in Openshift and could not. Is an application made in Ruby 2 compatible with Ruby 1.9? What versions are supported by Openshift? Follow the…
-
2
votes1
answer914
viewsButton with a value - Ruby on Rails
I have 2 buttons and each one will have to send a template value and will also be the submit button 1 and button 2 - depending on the button I click it will send the value to the @rating.type field.…
-
2
votes2
answers281
viewsTwo-dimensional array in Ruby
I have the two-dimensional array a = [[1,'a'],[1,'b'],[2,'c'],[2,'d'],[3,'e'],[3,'f'],[4,'g'],[4,'h']] and I want to separate the letters in another array b so that it looks like this: [["a","b"],…
-
2
votes1
answer760
viewsGoing up Ruby on Rails app in Heroku
I completely followed what was written on that tutorial and I got this mistake: root@neuber-HP-EliteBook-8460p:/home/neuber/node-js-sample/franca# git push heroku master Warning: Permanently added…
-
2
votes0
answers88
viewscaches_page in Rails 3 does not work in production
In development the caches_page works normally, but in production, it creates the cache and rewrites the cache at each access. Does anyone have any idea how this problem can be solved? My…
-
2
votes2
answers841
viewsExtra Fields Don’t Save With Devise
I’m new to Rails and I’m trying to implement Devise with a few extra fields. It is saving the email and password correctly, but my fields first_name and last_nameare not being saved. Are nil This is…
-
2
votes2
answers637
viewsHow to insert values from a Select field into the database
I’m a beginner in Ruby on Rails and need to add a Select field to the user registration form, so I can add a "Type" for the user to be registered. I intend to populate the fields automatically while…
-
2
votes2
answers2709
viewsError starting "Rails Server"
Hi I’m trying to install Ruby on Rails on Ubuntu and startar the server using the command rails server returns me the following error. felipe@Dumont:~/mo$ rails server…
-
2
votes1
answer305
viewsSum a value in a field with Rails
Hello! In my users table I have a field of downloads. I would like when the user enters the page I add +1 in this field of the user. What is the best way to do this? Do I really need to make 2…
-
2
votes2
answers172
viewsPull in Heroku database to local
I need to synchronize my database data in production with what is on my site, is there any way to pull the Heroku database to mine on localhost without having to create a new database locally? My…