Questions tagged as 'ruby-on-rails'

1
answer

Metaprogramming with ruby, methods with SELF

Good evening ... I come from other languages somewhat different to Ruby, like C / C ++, JAVA ... And I missed a little while trying to understand the difference of the following methods: Class teste def novo "1" end def...
asked by 13.06.2017 / 04:26
1
answer

Error in RoR: undefined method '[]' for nil: NilClass - NoMethodError in Site :: Home # index

This application was made using the following Bootstrap template: link In my case, after I made all the changes and adaptations, correctly doing the ASSETS and PRE-COMPILE'S, the application ran perfectly on my machine (locally / developmen...
asked by 18.07.2017 / 23:51
2
answers

Null return of an object in the controller - RAILS

Hello! I have the following code snippet from a controller called ProductsController: def index @produtos = Produto.all end def gerarlog @produtos.each do |produto| File.open('produtosBD.yml', 'a') do |arquivo| arq...
asked by 30.05.2017 / 21:01
1
answer

Ruby and PHP in the same VPS [closed]

I am considering the idea of hiring a VPS in Linode to host different projects. The issue is that some of them are in PHP and others in Rails. My question is: Is it possible to configure a VPS to run both technologies? Would you recommend...
asked by 11.04.2017 / 22:21
1
answer

CoffeeScript on Rails - select items from a table

Hello! I have the following code generated by Scaffold: <p id="notice"><%= notice %></p> <h1>Produtos</h1> <table class="table table-striped" id="tabelaProdutos"> <thead> <tr> <t...
asked by 26.05.2017 / 16:26
0
answers

How do I configure controllers to use requests?

After creating a controller a test for the controller is automatically created. You can disable this creation of the test for the controller using the code below: Rails.application.config.generators do |g| g.test_framework :rspec, controller...
asked by 10.03.2017 / 21:28
0
answers

How to play gem Audited logs in Logstash

What is the best way to play logs from gem Audited (rails to Logstash ? A Gem Audited : link     
asked by 23.01.2017 / 14:18
0
answers

Sort ActiveAdmin Index by boolean

In suggestion.rb I have the following code: index title: "Sugestões" do column "Título", :title column "Autor", :user column "Aprovado", :published actions end The last column: published is boolean type. I want to sort t...
asked by 30.12.2016 / 20:38
1
answer

How to authenticate an OAuth 2 connection with Postman?

My API uses in the Rails 5 backend gem devise_token_auth ( omniauth ) for authentication. The frontend is using ng-token-auth (Angular 1.x). I have all the API requests in Postman . I did the security implementation and I need to authent...
asked by 30.12.2016 / 12:15
0
answers

How to make a local variable an instance variable for an ERB template with binding?

Below I exemplify my need in a code where I need to redefine variables such as @dispute = dispute to be instance variables and the template loaded by ERB can access them through binding : class Remittance::ExportService def init...
asked by 02.02.2017 / 17:10