FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Share your cancer code!
NewsMachine Learning

Share your cancer code!

via Dev.toAugusts Bautra2h ago

Today I was doing a read-through of existing code to prepare for an upcoming feature, and I came across this abomination. # controller code # GET /project_team_tasks def show @teams = project . teams TeamTask . define_teams_quantity_distributions_attr_readers ( @teams ) end # model code def self . define_teams_quantity_distributions_attr_readers ( teams ) teams . each do | team | Budget . component_groups . each do | component_group | define_method ( "team_ #{ team . id } _assembled_elements_quantity_ #{ component_group } " ) do teams_quantity_distributions [ "team_ #{ team . id } _assembled_elements_quantity_ #{ component_group } " ] end end end end # then in view team . tasks . send ( "team_ #{ team . id } _assembled_elements_quantity_1" ) As far as I understand, calling the class method defines an instance method (a getter) for every team*component_group pair. Apparently the underlying data are stored in TeamTask instance teams_quantity_distributions jsonb field. This code is pernic

Continue reading on Dev.to

Opens in a new tab

Read Full Article
0 views

Related Articles

Proposing Botwatch
News

Proposing Botwatch

Lobsters • 18m ago

Amazon Spring Sale live blog 2026: Real-time updates on the best deals
News

Amazon Spring Sale live blog 2026: Real-time updates on the best deals

ZDNet • 46m ago

Ads are coming to Apple Maps, as Apple expands its business offerings
News

Ads are coming to Apple Maps, as Apple expands its business offerings

TechCrunch • 50m ago

I tracked my cortisol at home to see if blue light glasses really work - here are my test results
News

I tracked my cortisol at home to see if blue light glasses really work - here are my test results

ZDNet • 53m ago

PostGIS After pg_upgrade: The Extension Update Step Everyone Forgets
News

PostGIS After pg_upgrade: The Extension Update Step Everyone Forgets

Medium Programming • 1h ago

Discover More Articles