Questions tagged as 'ruby-on-rails'

5
answers

Error Division by 0

Hello I would like a help, I am starting with the language and I am trying some doubts, What I want in my code is that the calculation of the division is not divided by zero. At the moment I enter the value of Y = 0 return a message "Invalid,...
asked by 20.09.2017 / 21:56
1
answer

I can not convert sqlite rails app to postgres (for deploy heroku)

I have tried to do the conversion of a Rails app in sqlite to postgres in order to upa it in heroku, following this heroku's own tutorial: link But when I create a DB using rake db:create , I get this error message:    rake db: c...
asked by 16.11.2015 / 19:46
3
answers

Is it recommended to test model validations?

My experience is with Ruby on Rails, but I think my question will fit into other cases. The ORM ActiveRecord (from Rails) allows you to validate in fields such as: Presence Uniqueness Size (of a string ) etc I'm in doubt wheth...
asked by 18.07.2014 / 13:07
3
answers

How to simplify the translation call on i18n?

See this example below for a missing translation: { "errors": [ "Email translation missing: pt-BR.activerecord.errors.models.artemis/user.attributes.email.taken" ] } To resolve this translation I must exactly follow the structure ge...
asked by 20.03.2017 / 13:07
2
answers

Is there a correct place to load native Ruby libraries when using Rails?

In certain functionality of my application, I need to use the "open-uri" library, which is native to Ruby and does not have a library for Ruby on Rails. I'm using a require "open-uri" where I need it in the application and it's working...
asked by 06.02.2014 / 20:29
3
answers

Application ruby on rails

Is it possible to change the state of a rails application, from production to test? with the possibility of going back to production again     
asked by 17.01.2018 / 12:30
3
answers

How to implement an Abstract Controller that executes actions implemented in concrete controllers, depending on the variables passed via params?

I need an abstract controller to redirect the execution of the "create" and "show" actions implemented in modules, according to values passed through params, eg: class Indicator::AbstractController < ApplicationController # é aqui...
asked by 13.10.2017 / 12:57
2
answers

Registration on the form that is repeated every month

I'm developing an Rails app for controlling expenses and personal revenue. I wanted the form, when registering an expense, the user to mark a checkbox (it appears in the expense table as repeat: boolean) and then this expense would auto-check ev...
asked by 22.09.2017 / 19:00
1
answer

Text area with image

Hello, I'm going to make a form and I do not know how to do it to include an image inside the text area, something like that. TEXT TEXT IMAGE TEXT Something of a kind for the include user to know? As it is done here in stack ov...
asked by 02.06.2017 / 13:27
2
answers

How 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 position. ex: Person.take(3) // ele pegari...
asked by 02.12.2016 / 13:33