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
votes2
answers49
viewsHow to use HATBM with multiple models
I’ll have the model Tag he’s gonna have a relationship HABTMwith POSTS. But I want him to have a relationship too HABTM with USERS because my goal is in the future to be able to find posts that have…
-
0
votes1
answer60
viewsDefinition of Wordpress-style roles
I am planning the architecture of a personal project to be implemented using Rails. In it, I wish it was possible to easily modify the access rules of users, as is done in wordpress. I know there is…
-
0
votes1
answer101
viewsHow do I create DESTROY link with Slim?
I’m starting with Rails, and I’m not able to link to delete a "post" from the site. Follows how the links are new and edit p.btn = link_to "Editar informações", edit_property_path(@property) if…
-
0
votes2
answers152
viewsChartkick Problem in a Rails Application
I’m trying to implement the Gem Chartkick in a Rails application, but I’m having a small problem. My application has a relationship between two models: class Animal < ActiveRecord::Base…
-
0
votes1
answer543
viewsHow to perform actions at a given time using Ruby on Rails
In my project I would like to create alerts that run at each given interval or at a certain date, Some way to do, using as little memory as possible?
-
0
votes1
answer186
viewsUsing Ruby on Rails is it possible to perform external functions on the client side?
Example: On the computer that is with the browser accessing the page, with the proper permission, run a function in a DLL installed in it? Complementing: My intention was to use on an intranet, and…
-
0
votes0
answers60
viewsjavascript error, behavior/general.js
have the following error accusing in browser developer mode Uncaught TypeError: undefined is not a function general.js:1549 init general.js:1549 (anonymous function) login:542 c jquery.js:4…
-
0
votes3
answers262
viewsHow to instantiate a model and get its features by its name in Ruby on Rails
Since I have the abstract class User, and its sub-classes Client Employee and Admin, would like to render screens according to the chosen subclass. So: users/_form.html.erb : shall contain a…
ruby-on-rails ruby mvc abstract-classes instantiate-objectasked 9 years, 10 months ago user5020 1,027 -
0
votes2
answers511
viewsHow to prevent Heroku’s / Dyno server from hibernating or sleeping?
I wanted to know how to prevent the server (also called Dyno) of Heroku enter a state of hibernation or sleep after a certain period without visits in your free plan. Is it possible to prevent a…
-
0
votes1
answer64
viewsHow to share methods between presenters in Ruby on Rails 4
I would like to add methods to my model through a Presenter, but some methods are shared among other presenters. Ex: os métodos 'pode_ser_mostrado?', 'pode_ser_editado?', 'pode_ser_excluido?' What…
-
0
votes1
answer116
viewsHow to display a user’s Posts?
I’m trying to display user posts on perfil = link_to 'perfil', user_path(user) User data appears, but when I try to show user posts comes error: Nomethoderror in Userscontroller#show Undefined…
-
0
votes1
answer53
viewsHow to use text_field via ajax
I am trying to call via ajax a function in a text_field field, I tried it in two ways: 1 - From Undefined method remote_function error. <%= f.text_field(:data, class: "form-control", :remote…
-
0
votes1
answer51
viewsFirst scaffold error in Ruby
I’m looking to learn how to program in Ruby, I created the app, so I had an error from the beginning, where I had to remove all the HTTPS from the files of the GEMFILE folder, changing all manually…
-
0
votes1
answer60
viewsHow to create a new associated template in Rails
Assuming I own the user Admin, the Admin has a login_user, as system_user, and this relationship is polymorphic, because other types of users also have login_user. When creating the Admin, I must…
-
0
votes1
answer146
viewsError using Refile + AWS SDK
gem "mini_magick" gem "refile", require: ["refile/rails", "refile/image_processing"] gem "aws-sdk" My config/initializers/refile.Rb file require "refile/backend/s3" aws = { access_key_id:…
ruby-on-railsasked 9 years, 9 months ago Thiago Porto 292 -
0
votes1
answer323
viewsRelationships with Rails
I’m doing a small blog in Ruby on Rails, but I’m having problems in the comments part. In controllers/posts/comments_controller.rb I have the following: class Posts::CommentsController <…
-
0
votes0
answers107
viewsStar rating on my simple-form Rails does not send the value
I’m using a Jquery plugin to style an input field of mine with the style of "star rating", and this is the library: http://plugins.krajee.com/star-rating. I call the attribute in slim the following…
-
0
votes0
answers27
viewsRails 3 does not show ruby debug page 1.9.2
My Rails project no longer shows the debug page after I changed the machine project. How do I make such a page appear again?
-
0
votes2
answers496
viewsForm to change variable for a calculation in the same view
I’m starting with the Rails. I have a view that receives information from the database and by means of a model methods do several calculations. For example: <% @profundidade = 0.5 %> <%…
-
0
votes1
answer92
viewsResize images with Gem Refile
Is it possible to resize, I looked in the documentation and I saw nothing about it? Put in several sizes. In carrierwave has this option
ruby-on-railsasked 9 years, 8 months ago Thiago Porto 292 -
0
votes1
answer177
viewsReset Password with Rails
I am working on a project and I need to do a password reset system. I’m not using g and I don’t want to use. I found that the can_change filter runs and I am redirected to the user page, which makes…
ruby-on-railsasked 9 years, 9 months ago leonero 177 -
0
votes1
answer1942
viewsHow do I connect to an existing Rails database?
I wonder if there is how to connect to Postgresql, so I only read the data of the tables that are already created. I am developing an API, which will read in a given database, and return an XML, for…
-
0
votes1
answer84
viewsRor application in windows CE
I wonder if there is any possibility to make a Rails application for Windows CE ? We need to make an application to run on a data collector that has the Win CE. This device will not have network…
-
0
votes2
answers268
viewsError 500 when accessing page Edit, ruby 1.9.2, Rails 3.2.13
I have an application in Rails that just after loading the page Edit.html.haml rendering the layout returns me an error 500, the table in BD has only one record and is linked to the other table…
ruby-on-railsasked 9 years, 9 months ago André Ventura 83 -
0
votes1
answer58
viewsError sending email with Mandrill
Modelo contact.Rb: class Contact include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming attr_accessor :name, :email, :message, :subject validates_presence_of…
ruby-on-railsasked 9 years, 8 months ago Thiago Porto 292 -
0
votes2
answers69
viewsRequire files on Seeds.Rb
I need to organize my file Seeds.Rb, so I created a namespace where I will add my ex classes: module Seeds class Apple def self.run puts 'teste' end end end Seeds::Apple.run This works perfectly,…
-
0
votes4
answers1008
viewsError starting Rails Server
I’m trying to start the Rails Server but it is always returning me many errors, one of them was about the Sqlite that already corrected by downloading the Gem and modifying the require_paths no…
-
0
votes1
answer677
viewsDevise - Email confirmation and Forget password? [ email does not send ]
Problem sending Confirmation Email and Password Change Problem After requesting to send the forget password? he keeps carrying it until he gives time out. The creation of the Password exchange token…
-
0
votes1
answer121
viewsRemove elements outside the standard deviation
I have the following array [123, 350, 3456, 98] and need to remove items outside the standard deviation as in this case the 3456. I have already calculated the standard deviation as below: class…
-
0
votes0
answers850
viewsI18n Translate Enum
I have an Enum in my model containing the states, and I created a translation for it with I18n but it gives the following error: Translation data {...} can not be used with :Count => 1 My Enum:…
-
0
votes1
answer122
viewsActiverecord Labels using I18n
I have the following code: en.BR.yml activerecord: attributes: city: codigo_municipio: "Código do município" View = label(:city, :codigo_municipio) Expected result: # => <label…
-
0
votes1
answer1125
views'Web application could not be Started', Why?
I am passing my project to the server. I am using Nginx. And it is all installed now, because when I go to my initial address it shows me: Welcome to nginx! If you see this page, the nginx web…
-
0
votes0
answers496
viewsUndefined method 'map' for nil:Nilclass
I’m having this problem if the validator finds an error after submitting the form. I think it might be because my instance variable, @users, is nil? I know it in the controller with before_action,…
-
0
votes1
answer52
viewsWhy does this way of using case not work?
I have the following code: def label_file_type(type) label = case type.to_s when ['.jpg', '.jpeg', '.png'].include?(type) then content_tag(:span, 'Imagem', class: ['label', 'picture']) when…
-
0
votes1
answer61
viewsTemplate error no rspec-Rails
I’m using the rspec-Rails to test my application, however while testing a view using Ransak for filters I have the following return error: 1) admin/cities/index renders a list of admin_cities…
-
0
votes1
answer72
viewsRuby template error
I got this mistake while trying to learn the basics of ruby someone knows how to solve? Missing template articles/index, application/index with {:locale=>[:en], :formats=>[:html],…
ruby-on-railsasked 9 years, 6 months ago Kallan 177 -
0
votes1
answer115
viewsDatabase configuration using rspec-Rails
In my spec/rails_helper.Rb I added the following code so that the database was automatically created when running rspec: def database_exists? ActiveRecord::Base.connection rescue…
-
0
votes1
answer525
viewsI can’t update a Ruby project on Heroku with Git
While trying to commit a few changes I made to my Ruby project and go up to Heroku, I got an error message. Inside the project folder in the terminal I executed the commands: $ git status $ git add…
-
0
votes1
answer355
viewsHow to generate sequential numbers automatically with current year in Rails?
I need that when a new product is created it generates a number ex: 0001/2015 numero/ano_in effect and when it changes year back to zero. I made a helper just to format the number in the views, but…
-
0
votes1
answer70
viewsMake condition within the surrender
I’m learning Ruby and I’m having a question about how to make a if inside the render to display the param only if he exists... Ex: if params[:field] puts 'field' => params[:field], end How do I…
-
0
votes1
answer33
viewsLoad skrollr.init the right way in Rails
I’m using the Skrollr in an application Rails as follows: Gem Utilizado: gem 'skrollr-rails' app/Assets/Javascripts/application.js //= require jquery //= require jquery_ujs //= require turbolinks…
-
0
votes0
answers160
viewsError while initializing my application on Rails
My application was already running for some time without problems, I myself configured the environment in a virtual machine. I had to stop the server and when I went startar again I had this little…
-
0
votes1
answer147
viewsComposite index - M:N in Ruby on Rails
I need to add a double index to the ratio N to N, from the table courses_internships. would be more or less like this: add_index[:course_id, :internship_id]. However, when I created the link table,…
-
0
votes1
answer88
viewsStart Ruby application on boot
Hello, I have Openproject, a Ruby on Rails application, I want it to start next to the system boot, I put the script to start from Upstart, but when starting the system, I see this error in my log:…
ruby-on-railsasked 9 years, 5 months ago Roknauta 2,811 -
0
votes1
answer166
viewsHow does social application integration work?
Lately it has become increasingly common to integrate applications of various types into social networks, such as Facebook, Twitter and even Github. I wanted to understand how this integration…
-
0
votes2
answers67
viewsRails does not accept request
I set up a simple API in Rails, it only reads the database, and returns the JSON according to the request. However, I went to test the API, making a request with another device, connected via…
-
0
votes2
answers146
viewsAdvanced query in Ruby On Rails (Activerecord)
I need to make a query for a report more or less like this: Produto.include(:clientes).where('count(produto.id) < cliente.quantidade') In sql would be more or less like this: SELECT C.NOME,…
-
0
votes2
answers1228
viewsChange date format in Rails form
I know there is how to edit in the location, to pass it to the Brazilian format. But I do not know the syntax to change the format in the form: <div class="field"> <p> Garantia…
-
0
votes1
answer367
viewsPage loading Ajax + Jquery + Ruby on Rails
Oops, good afternoon guys I’m a little new in Rails and to with a little difficulty. I have a login form (Sessions/new) and a registration form (users/new), in each of these formularies, I have a…
-
0
votes1
answer78
viewsAuthorisation problem with Pundit
On the controller lodger put this function authorize, passing user who is logging into the system, within the method #destroy. What I need is that only the user admin can perform the deletion…
ruby-on-railsasked 9 years, 3 months ago Raul Martins 41