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
-
21
votes4
answers15388
viewsHow to make a table responsive using (Twitter) Bootstrap?
I’m working on a web application using Ruby On Rails 4 and much of the interface consists of tables. I would like you to suggest a way to detect the screen size in use and, based on this, hide…
-
21
votes1
answer4711
viewsHow to program in Portuguese in Ruby on Rails?
I would like to know how to program an application in Ruby on Rails in Portuguese instead of English. There are basically three problems in that: How to change the user interface to Portuguese?…
-
9
votes2
answers531
viewsAssociation with scope in Ruby on Rails
I have a Ruby on Rails application in which I have licenses, items that can be licensed, and a table that lists the two (Which items do you have in the license?). Analogously to items in a shopping…
-
9
votes2
answers879
viewsRecover Error messages via json in Angular
I’m trying to register using Angularjs, but I want to get the validations that are in my model in Rails. But I’m having difficulties: Covenat(model) Rails validates :name, presence: true controller…
-
8
votes1
answer373
viewsOffline mode Rails app
In a new endeavor, I need a simple application to stay working if the internet connection is lost. Can someone explain to me how to do this? I had thought to use HTML5’s persistence features in case…
-
8
votes2
answers1213
viewsWhat are the advantages and disadvantages of storing session variables in the database?
From Rails 4.0, was eliminated the Activerecord Session Store, that kept session variables in the database, for "performance issues." But the functionality continues to work through a Gem. Today…
-
8
votes1
answer716
viewsIn Ruby on Rails is the business rule on the model?
In Java the business rule is in controller, but I heard a speaker saying that in Ruby on Rails the business rule is on model. Someone confirms that to me?
-
7
votes2
answers2443
viewsHow to print a web page using the backend Rails?
It would be possible to do this? For example: I point a page to my application, and she keeps a image of the page indicated. A print.
-
7
votes1
answer6657
viewsWhat is attr_accessor in Ruby?
I’m learning Ruby on Rails and in the content I am studying I could not understand well what is the attr_accessor and how it works.…
-
7
votes2
answers213
viewsHeroku deploy with Bower-Rails
I have the gem 'bower-rails' installed in my application but when deploying I have the following error: I added the gem rails_12factor I’m using the buildpack: heroku buildpacks:set…
-
7
votes3
answers402
viewsSending email via a notification button
I wonder if you have done or have any example that can send the link to the following problem: I have a project that has the Books crud and a User controller with their respective views. I made the…
-
6
votes1
answer102
viewsDoubt Relationship Rails
I’m learning Rails still, and I’m in doubt if I’m doing it right. I have a Table Animal and a table Reproduction, each animal may have one or more reproductions and each reproduction will only have…
-
5
votes1
answer210
viewsUpdate BD table by clicking a <li> element
I’m developing a mobile application using jqMobile and Ruby. How to update a database table by clicking on an item in a list. My list is generated like this: <ul data-role="listview"…
-
5
votes1
answer1161
viewsRails and Webmotors
someone with some experience with Rails integration with the Webmotors Api? I am using Gem SAVON to integrate the application with the site API and am getting the error: Savon::Soapfault:…
-
5
votes3
answers390
viewsCalculate parent and child totals
Friends have 2 templates. Orders have several Details. I use Cocoon to create forms. The order model has a total that is the sum of the child model totals. What I would like to know is what is the…
-
5
votes1
answer188
viewsDefining a tree structure in ruby on Rails
I’m developing a system in ruby on Rails, and I’m stuck on a question. My question is this, I need to create a tree, and then create my 'no' object and I would like it to have a 'no' parent and a…
-
4
votes1
answer816
viewsHow to update with AJAX a list after the action of a remote form?
I have a problem I’ve never had in Java but I’m almost going crazy in Rails. I’m developing a project where there are users and groups. So I created a separate model for relationship N:N between…
-
4
votes1
answer92
viewsError in db:create on Mac OSX Montain Lion
alexandesigner$ rails server dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info Referenced from:…
-
4
votes3
answers131
viewsProblems with belongs_to when using Ajax in Rails 4
I have three models in my application, Order, Product and Items. Within Items I have the following code: class Item < ActiveRecord::Base belongs_to :product belongs_to :order end I have a form…
-
4
votes0
answers931
viewsHow to make multiple image uploads with Rails 3?
I ran a scaffold with the name "Property", I need to add images next to it preferably in a different model referencing (1 Property can have many images), where the user can select more than one…
-
4
votes2
answers195
viewsCarrierwave - destroy object only after it has been deleted from my storage
Carrierwave only deletes the 'mounted' file after the object in the database has been removed: after_commit :remove_avatar! :on => :destroy https://github.com/carrierwaveuploader/carrierwave I am…
-
4
votes1
answer640
viewsPassing parameters to the as_json method
I am trying to pass parameters to the as_json method (overwriting the method) in my model. Because only with the date that comes from the user can I return my result. According to this past date I…
-
4
votes2
answers255
viewsHow is it different to declare a variable with and without "@" in Ruby?
What is the difference between these two possibilities? //com @ @post = Post.find(params[:id]) //sem @ post = Post.find(params[:id]) Normally in controllers is used with @, but in office each views…
-
4
votes1
answer210
viewsRuby on Rails boot time
In Ruby on Rails, using the Minitest library, the test run time is fast. But the boot time before each rake test (...) is pretty annoying. Is there any way to make it faster? Updating I tried to…
-
4
votes2
answers266
viewsUpdating Header with Jquery after page reload
I have a partial in Rails to load my header in all pages.. _header.html.erb: <ul class="nav navbar-nav"> <li><%= link_to "Home", root_path %></li> <li><%= link_to…
-
4
votes3
answers4318
viewsHow to set your own domain in Heroku?
I bought a domain and need to configure together my application that is in Heroku. How to do this?
-
4
votes1
answer830
viewsHow to access elements of an iframe from an external page?
I need to access an id inside an external page I’m rendering in an iframe on my site. That permission error is occurring. How to resolve this? This is the page link:…
-
4
votes1
answer790
viewsDynamic calculations in Rails
I hope you can help me. I have a Rated who owns evaluations, have several calculations to determine whether or not it will pass an evaluation step. For example one of these calculations is…
-
4
votes1
answer86
viewsFirst table id does not click on BD
I’m trying to create a simple contact schedule with two tables: Being one of them empresa :nome and the other contatos :nome :telefone :email... I created the two tables and put a Foreign_key in the…
-
4
votes3
answers29719
viewsHow to create a button(button) or a link(a) to download a particular file?
I need to create a button that when clicking is performed the download and not open in another tab or window. Can be any type of file both image, pdf, music among others.
-
4
votes1
answer201
viewsProblems running only one unit test on Rails 4
When I run all the tests or just tests a file is working normally, but when I try to run just one test, it just doesn’t run. I have this test require 'test_helper' class UserTest <…
-
4
votes3
answers176
viewsHow to work with tests and fixtures in a bank that contains foreign key constraints in Rails?
I am using Rubyonrails 4.1 and Postgresql database and use the Gem Foreigner to create foreign key restrictions in the bank. It turns out that this makes some tasks with fixtures. When I try to run…
-
4
votes1
answer802
viewsHow to model product categories?
I am about to start the development of an e-commerce, but I am focused on the issue of modeling, especially regarding categories and subcategories of products. For example. A category can have…
-
4
votes1
answer241
viewsstart Vagrant server in windows using git bash
As seen in the log below when starting the server such error occurs. Dei Bundle install and then tried to start the server. => Booting WEBrick => Rails 4.1.1 application starting in…
-
4
votes1
answer136
viewssynchronize two screens
I am starting to develop a scheduling system in Rails and I have the following problem: Let’s say I have two open screens in my book: 1.1 - First screen opens on doctor’s computer. 1.2 - Second…
-
4
votes3
answers2889
viewsRunning my Angularjs application on some server
I have a front-end application consuming an Rails api, but I’m new to this idea of separating the front-end from the back-end, my api runs on localhost:3000, and my front is simply a folder that I…
-
4
votes3
answers670
viewsHow to sort sql queries in the RUBY on Rails model?
I have the following method an ROR application. query_student = "SELECT name, registration, room FROM students WHERE registration = "+ params[:registration]+" AND password = "+params[:password]…
-
4
votes1
answer70
viewsError saving marked data in a query
I’m creating a Survey that will save the vehicles. For this I have to make a form divided into several pages but when I change the page the data marked on the radio Buttons are lost Controller def…
ruby-on-railsasked 8 years, 5 months ago C Junior 43 -
4
votes1
answer174
viewsDoubt about float field query (ruby on Rails with mysql)
Hello, I have a question regarding the database with Rails. If I declare a field to be "float", when I do the query, I need to use the ". to_float" so that Rails understands the type of this field?…
-
4
votes3
answers494
viewsInstalling ruby with rbenv
I have a question, I installed the ruby in Ubuntu, but it was installed without the rbenv, has any problem installing it now, or it will be necessary to remove it first?…
-
4
votes1
answer121
viewsHow do I get Exception Mongoid::Errors::Documentnotfound released on Mongoid
I’m trying to do a test similar to the one below to capture the Exception of a non-existent document expect(Produto.find('57e2bf76ce222fd11258cd4e')).to…
-
4
votes2
answers82
viewsHow to return null if no result is found with find_by?
I’m getting a return as an array ([]) of a scope with find_by and I wish the return to be empty (null). See below some snippets of the code: class Dispute::Conference < ApplicationRecord ...…
-
3
votes1
answer1745
viewsSyntax error, Unexpected keyword_end, expecting end-of-input
I’m in a lot of trouble (It may be ridiculous thing but I don’t know what to do anymore). The following error is appearing: Syntaxerror in Group::Groupsuserscontroller#create…
-
3
votes3
answers1088
viewsWhere to put this logic? Controller or Model?
My application has the following logic: Given a link received, the application takes the attribute <title> of the page and turns this attribute into the link description and saved in the bank.…
ruby-on-railsasked 10 years, 10 months ago Fábio Jansen 82 -
3
votes1
answer69
viewsMap Substring Solr
I have the following question, I have the model city(name, uf, province) I’m trying to implement the Sunspot search method, but I’m getting it on my own: # modelCity.rb searchable do text :name end…
-
3
votes1
answer341
viewsWhat is the best way to add ENUM fields to the Rails 4 model?
I need to reference the field numbers status of the database, which are in the format ENUM, with the names of my model. What’s the best way to do that? models/item.Rb class Item <…
-
3
votes2
answers1157
viewsRails 4: Changing the "Development" database from Postgresql to Sqlite3 makes the Rails server error
Hello. For some reasons, I had to change my DB "Development" from Postgresql Rails back to Sqlite3. Only the page has stopped working and the error that appears in the server Rails output is this:…
-
3
votes1
answer89
viewsRuby-on-Rails Insert/uptade external program
I’m studying a little Rails for a new project and a question has arisen that is: When I give a db:migrate, Rails creates/alters the entire database structure - when necessary - based on the model.…
ruby-on-railsasked 10 years, 8 months ago Clebao 655 -
3
votes1
answer66
viewsstrong_parameters in Rails using datetime
I’m using strong_parameters to create an object nested in a form. All my attributes work correctly, except those defined in datetime. There’s something special about getting datetime nestled?…
-
3
votes3
answers144
viewsShould I use Symbols in hashes and parameters to optimize memory usage in Ruby?
On this other question here I asked about :symbols and 'strings' and found that the use of :symbols optimizes memory usage by the application. My question is whether the same goes for hashing: hash…