Questions tagged as 'ruby'

1
answer

undefined method 'chomp' for nil: NilClass

Good night everyone. I'm learning Ruby and I came across this error in the code I'm creating and can not continue or find the error. Can someone tell me where the error is? :( I'm trying but knowing little ruby I still can not understand why...
asked by 14.09.2015 / 04:29
1
answer

Doubts about relationship between Rails tables

Hello, I am a beginner in Rails, (setting up my first system) and I have two doubts about relationship between tables: 1.) I have a Line template with the source and destination attributes that should reference another Local , ie Line...
asked by 03.07.2015 / 01:26
1
answer

How to leave this DRY code block in Ruby

I have this block of code here: if contract.amendments.empty? if Date.today - contract.due_date >= 30 || Date.today + contract.due_date <= 30 @start_date = contract.due_date + 1 @end_date = contract.due_date + 365 elsif Date....
asked by 15.04.2015 / 15:30
1
answer

How to model a feedback system

I'm developing an application in Rails. I would like to know how to model the comments part. There is a table for the calls (Helpdesk system), and it is related to the history table, which is the comments. My question is, how can I find out who...
asked by 02.04.2015 / 21:40
1
answer

I18n 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: unless instance_methods.include? :u...
asked by 09.04.2015 / 19:58
1
answer

How to create block helpers in Rails?

I need to create a dropdown menu helper ... But I have no idea how to do this. I wanted a helper in block form, as it is done with forms. Ex.: <%= form_for(@teste) do |f| %> <%= f.text_field :um_campo %> <% end %> In m...
asked by 16.12.2014 / 21:45
1
answer

Using Jekyll creating a news feed

I have the following question how do I create a news feed? Do I have to add something inside the config.yml file? Inside the _post folder I have the file 2015-03-03-welcome-jekyll.markdown --- layout: post title: "Welcome to Jekyll!" date:...
asked by 06.03.2015 / 17:12
1
answer

Error installing SASS in Windows 8

   ERROR: Could not find a valid gem 'sass' (> = 0), here is why:            Unable to download data from link - SSL_connect returned = 1> errno = 0 state = SSLv3 read server certificate B: certificate verify failed > (< a href="https://...
asked by 27.01.2015 / 13:34
2
answers

Adding values from a column with Ruby

Hello, I'm starting out with Ruby On Rails, and I'm making an application that manages expenses. Well what I need to do add up all the expenses of the "value" column and show in the view. I'm trying the following in ActiveRecord def total...
asked by 01.10.2014 / 05:02
1
answer

How to add functionality to a Model that depends on Controller or View

I would like to add the following methods to my Models when presented in the View, such as can_be_showed , can_be_edited , can_be_destroyed , among others, however in some cases these methods may depend on Controller , such as...
asked by 27.01.2015 / 04:31