active_decorator gem

August 08, 2020 05:42

Keep helpers and views object-oriented by decorate modelsource codeQuick startadd gem to gemfilegem 'active_decorator' Then bundle install Create a simple model I called it Author with 2 attributes, first_name and last_namerails generate model Author first_name last_name run migrationrails...

ViewComponent gem

August 07, 2020 15:22

It is a framework for building view components in Ruby on Rails.Ruby objects that output HTML.Benefit:Unit-testedCheaperQuick startbin/rails generate component Example title content also support others template engines such as erb, haml, and slim.bin/rails generate component Example title...

ruby blogs

August 07, 2020 14:37

what to consider

July 17, 2020 04:57

If Design less, Do more or If Design More, Do Less

How to growth

July 17, 2020 02:33

How to works as a team but independently

Introduction in Python

July 14, 2020 14:42

list = array (ruby)+ slice[start:end]<inclusive:exclusive>del() : remove item from the list.x = ['a', 'b', 'c'] del(x[1]) # ['a', 'c'] = copy by referencelist() , [:] copy by valueimport numpy;import numpy as np; # recommended, it's clearly define what array belong to npfrom numpy import...

admin theme ruby on rails

July 14, 2020 06:02

jquery , rails remote : true

July 09, 2020 07:09

This work for the fresh page.$jquery = $("#audio") but after$('.modal-body').html('<%= j render("form") %>'); the $jquery will not work anymoreit seems like jquery still remember the cached and can't reference the new onethat rails,$jquery = $(".modal-body").find("audio") Helps,

union join

July 07, 2020 07:35

def join_both_message inner_query = Message\ .merge(join_voice_message)\ .joins("UNION SELECT messages.* FROM messages")\ .merge(join_text_message)"*").from(inner_query, :messages) end

jQuery querystring

July 01, 2020 09:59

When select option is changed, link to new page with query string$(document).on("change", "#province", function(e) { var province = $(this).val() var params = new URLSearchParams( params.set('province', province); var url = `${location.pathname}?${params}` ...

🎉 Research topics

June 27, 2020 01:07

Devise extensionsMasqueraderails templatesshfsmicroservices

deep munge in rails

June 26, 2020 08:00

When submit a form , rails will strip empty paramsso you cannot update roles by just clear all roles from this variable.this is an expected behavior in rails (for security reason)I also have to try to disable deep_munge but still no luck# config/application.rb config.action_dispatch.deep_munge =...

hello world

June 24, 2020 17:56

My name is radinNice to meet you.