Posts by Bruno Wego • 1,568 points
92 posts
-
1
votes1
answer43
viewsQ: How to use t (tabulation) on EOF outputs?
See the example below: cat << EOF alias\tVARIABLE = command EOF Execution output does not take regex into account \t.
-
1
votes3
answers817
viewsQ: How to simplify the translation call on i18n?
See this example below of a missing translation: { "errors": [ "Email translation missing: pt-BR.activerecord.errors.models.artemis/user.attributes.email.taken" ] } To solve this translation I must…
ruby-on-railsasked Bruno Wego 1,568 -
1
votes1
answer70
viewsQ: Is there a need to declare the same dependency in Gemfile and gemspec?
I have several Engines in my API, all have as a dependency Artemis::Core. I want to understand the difference between declaring Gemfile, for example Gem artemis-core: source 'https://rubygems.org'…
-
1
votes0
answers34
viewsQ: How do I set up controller tests to use requests?
After creating a controller a test for the controller is automatically created. You can disable this test creation for the controller using the code below: Rails.application.config.generators do |g|…
-
0
votes3
answers50
viewsA: How to display a component only on the home screen?
Simple solution, after a few searches on Github. Just install the ember install ember-truth-helpers and check with route name: {{#if (eq currentRouteName 'index')}} {{jus-hero}} {{/if}} I hope I’m…
emberjsanswered Bruno Wego 1,568 -
0
votes3
answers50
viewsQ: How to display a component only on the home screen?
Within the application.hbs I have a component called jus-hero: <header class="bg-leaf"> {{jus-hero}} </header> <main class="l-main"> {{outlet}} </main> How to render this…
emberjsasked Bruno Wego 1,568 -
0
votes2
answers57
viewsA: How to return data from the i18n translated api?
The way I found to resolve the issue was by defining method by method for each attribute. See below the code: # frozen_string_literal: true class User class RolesSerializer <…
ruby-on-railsanswered Bruno Wego 1,568 -
0
votes2
answers57
viewsQ: How to return data from the i18n translated api?
My API returns serialized data with active_model_serializers, some of these attributes are translated into frontend using angular-translate. The dictionary containing the translations is increasing,…
ruby-on-railsasked Bruno Wego 1,568 -
0
votes1
answer44
viewsQ: How to get md5 from a record and check if it is unique?
I have an atypical need where several records are imported by lot, these records have no unique identifiers, each record has information about a debt. I am imagining creating an md5 of each record…
ruby-on-railsasked Bruno Wego 1,568 -
0
votes0
answers12
viewsQ: How to resolve issues related to loading modules/classes that are still in memory?
Round and a half my Sidekiq gets the error shown below, and soon after is played again to run queue. After a while, the error automatically disappears and the queue continues to run normally.…
ruby-on-railsasked Bruno Wego 1,568 -
1
votes0
answers74
viewsQ: 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 so that they are instance variables and the template loaded by ERB can access them through the…
-
0
votes1
answer94
viewsA: How to return the complete object from an associative table?
Can effect the result I want using Serializer. First set in serialize relationships: class Dispute::UsersRolesSerializer < ActiveModel::Serializer belongs_to :user, serializer:…
-
0
votes1
answer94
viewsQ: How to return the complete object from an associative table?
The code below returns only the ID’s of their respective relationships, need that instead of returning user_id and role_id return the object user and role with the registration data. Take a look at…
-
2
votes2
answers82
viewsA: How to return null if no result is found with find_by?
The way I found to solve this was by using a .present? inside a parole at the place where I make the call from scope scheduled: class DisputeSerializer < ActiveModel::Serializer ... has_one…
-
4
votes2
answers82
viewsQ: How 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 ...…
-
0
votes1
answer47
viewsA: Bcrypt - Automating password encryption process
There is a solution, a bit old, for this. You can let Aim do it for you. This solution comes from this gist. class User < ActiveRecord::Base alias :devise_valid_password? :valid_password? def…
-
2
votes1
answer116
viewsA: How to add globally allowed parameters in Rails?
The best alternative I found, given my need to abstract the address parameter I use in several Sources was to create a module returning an array with the attributes, see below: module…
ruby-on-railsanswered Bruno Wego 1,568 -
1
votes1
answer116
viewsQ: How to add globally allowed parameters in Rails?
In several Sources I use address, I decided to allocate logic in Concerns. A need is to add the allowed address parameters, see below the Concern that should add permission to address_attributes:…
ruby-on-railsasked Bruno Wego 1,568 -
0
votes1
answer72
viewsA: How do I resolve pull request with deleted branch (Unknown Repository)?
This is an issue, widely discussed, on this Github site. There is no alternative to resolve this issue. The important thing is not to delete the branch as long as the pull request is not approved.…
-
0
votes1
answer46
viewsA: Problem with HTML content presentation using this.props.Children with ngReact
As commented on that occasion, that doesn’t work, you need to add the children on the React.js side, so it is possible to rewrite the component. See below for the example in Issue: let Alert =…
-
3
votes1
answer87
viewsA: How to force a nested route to use the same parent route parameter name?
The solution is simple and is in own documentation of routes. Just add the call to the option on: :member: resources :disputes do scope module: :dispute, except: :index do resources :conference,…
ruby-on-railsanswered Bruno Wego 1,568 -
2
votes1
answer87
viewsQ: How to force a nested route to use the same parent route parameter name?
My route scheme needs to add 3 new routes to custom actions in my controller: start, Cancel and Finish. resources :disputes do scope module: :dispute, except: :index do resources :conference,…
ruby-on-railsasked Bruno Wego 1,568 -
0
votes1
answer92
viewsA: How to remove upload files after the db:drop command in Rails?
The solution is simple, create a task called cleanup with the method uploads: rails g task cleanup uploads Now add the code below to this task: namespace :cleanup do desc 'Removes all Shrine…
ruby-on-railsanswered Bruno Wego 1,568 -
0
votes1
answer92
viewsQ: How to remove upload files after the db:drop command in Rails?
My API uses the Gem shrine to effect several different types of uploads. Unfortunately during development the files are accumulating in the folder public/uploads every time I do db:drop of the…
ruby-on-railsasked Bruno Wego 1,568 -
0
votes1
answer39
viewsA: How do I enable Rails to support multiple open connections to the data cluster?
The problem is in Postgresql! To resolve it is necessary to terminate the connection before creating a new one. Fortunately it is possible to create a task to do so and invoke connection closure via…
-
0
votes1
answer35
viewsA: belongs_to association inside serializer is not returning anything
The problem is that by default the active_model_serializers only presents a level in the serializer. It is necessary to add to the file active_model_serializers.rb in config/initializers setting for…
-
0
votes1
answer39
viewsQ: How do I enable Rails to support multiple open connections to the data cluster?
I use Postgresql in my API and if my GUI (Navicat) is open accessing the application database and try to run the command db:drop db:create db:migrate db:seed get the error below:…
-
2
votes1
answer401
viewsA: How to run the puma server with SSL in development?
By default Rails does not offer this feature, it is necessary to be configured, generate SSL certificates. Below detail the procedure. Self-signed SSL Certificate We will generate the signed…
-
2
votes1
answer401
viewsQ: How to run the puma server with SSL in development?
My Rails 5 application uses Webrtc, and Webrtc (camera, etc) only works with SSL enabled. I use a local SSL server. What are the correct procedures to implement and enable SSL support on the puma…
-
2
votes2
answers1809
viewsA: How to create a fixed column (col-Md) in bootstrap?
One of the examples in the Bootstrap v4 documentation details very well how to do this type of effect, with a fixed bar and the other with scroll. Create the HTML structure this way: <div…
-
1
votes1
answer131
viewsA: Post e Put com Restangular para api Ruby on Rails
The solution is to use a customPUT. See below how I describe access to my API through a Factory using ES6: const ApiFactory = (Restangular) => { 'ngInject'; return…
-
6
votes1
answer431
viewsA: Text effect or paragraph loading
This is a technique used in user experience. A great article called The Illusion of Time (The Illusion of Time) explains very well how human perception of time can be "dribbled" using simple…
-
0
votes1
answer1463
viewsA: How to authenticate an Oauth 2 connection to Postman?
After several attempts and errors, I was able to effect the authentication process in my API and proceed with the accesses to Resources. Below I detail the procedure. Any doubt use the comments…
-
2
votes2
answers550
viewsA: How to do advanced searches on Github?
After some research I found how this can be done. It is possible to search for specific files, dates, directories, among many other forms of search. See below some examples: filepath:app/models…
githubanswered Bruno Wego 1,568 -
0
votes1
answer35
viewsQ: belongs_to association inside serializer is not returning anything
The application contains a module called Dispute, this module contains Procedures, each Procedure contains a user and belongs to a dispute. As described below, belongs_to is not displayed and the…
-
1
votes2
answers550
viewsQ: How to do advanced searches on Github?
You can build custom operators/queries in Github search? Github provides the advanced search through a GUI, but also, as there are searches advanced Google (site:, cache:, etc...), it is possible to…
githubasked Bruno Wego 1,568 -
0
votes1
answer47
viewsA: How to return the correct Location to route with Resources in the singular?
After several attempts and errors the solution seemed. First it should be moved shallow: true for the call of resources and finally the attribute should be added shallow_prefix: :dispute. See below…
ruby-on-railsanswered Bruno Wego 1,568 -
0
votes1
answer47
viewsQ: How to return the correct Location to route with Resources in the singular?
When using the controller name in the singular, the path is prefixed with _index at the end of the route name (ex. dispute_conference_index). Inside the controller in the method create the parameter…
ruby-on-railsasked Bruno Wego 1,568 -
1
votes1
answer1463
viewsQ: How to authenticate an Oauth 2 connection to Postman?
My API uses in the backend Rails 5 to Gem devise_token_auth (omniauth) for authentication. The frontend is using ng-token-auth (Angular 1.x). I have all API requests on Postman. I did the security…
-
0
votes1
answer24
viewsA: How do eager_load with nesting controllers?
Solution below solves this question. Just set to the method index a query that searches all conferences through the dispute_id, see below how it looks: def set_conferences @conferences =…
ruby-on-railsanswered Bruno Wego 1,568 -
0
votes1
answer24
viewsQ: How do eager_load with nesting controllers?
In the index method of the controller Disputes::ConferencesController list all the conferences of disputes. The URL address is disputes/1/conferences. My route schema is like this: resources…
ruby-on-railsasked Bruno Wego 1,568 -
0
votes0
answers27
viewsQ: How to serialize an object generated by Factorygirl?
I have an object user generated by FactoryGirl like the below: FactoryGirl.define do factory :user do name { FFaker::NameBR.name } image { FFaker::Avatar.image } email { FFaker::Internet.email }…
-
0
votes1
answer27
viewsA: How to add dynamic buttons per loaded page?
The best solution and still with support for a future configuration is using a Provider. How I am using ui-router, I decided to put the dynamic button settings directly in the route creation, see an…
-
0
votes1
answer27
viewsQ: How to add dynamic buttons per loaded page?
My controller calls Factory Action and adds buttons on the page I’m loading, see below the controller: class AgenciesListController { /* @ngInject */ constructor(Action) { this.action = Action;…
-
0
votes1
answer67
viewsQ: Application based on multiple authorization profiles
I have a handful of doubts in an interesting scenario, I hope you can give me a little help. I am using in an angular application the package ng-token-auth for authentication, for permissions…
-
0
votes2
answers135
viewsA: How to check in an Angular directive if the parent Node is a link?
After an analysis and some console.log in the code, I was able to find the solution I was so eager to find: angular .module('xx.chip', []) .directive('xxChip', chip); function chip() { var directive…
-
1
votes2
answers135
viewsQ: How to check in an Angular directive if the parent Node is a link?
I need to make a check if my directive xx-chip is within a link. I cannot use jQuery in this application, only Angular. <a href> <xx-chip></xx-chip> </a> Thank you.…
-
0
votes1
answer72
viewsQ: How do I resolve pull request with deleted branch (Unknown Repository)?
After being made a pull request removed the linked branch and the message unknown repository is presented. Is there any way to re-link this pull request a new branch or the only way is to redo the…
-
1
votes2
answers1030
viewsQ: How do NPM always update the latest Comite in master?
I have a local repository (gitlab) with several components, I’m pointing to package.json each component directly to this repository. See below for an example: "dependencies": { "XX-alert":…
-
1
votes1
answer46
viewsQ: Problem with HTML content presentation using this.props.Children with ngReact
I’m trying to present the content I inject into an Angular directive within an React component. See below for the call to the component: <alert type="'danger'">…