Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

get rid of redundant .itself operations #9

@catmando

Description

@catmando

consider

class Dish < ActiveRecord::Base
  def replace_recipe
    ts = Time.now
    ReactiveRecord.load do
      Recipe.random_recipes([], recipe.duration, recipe.dish_type, ts).first.itself
    end.then do |new_recipe|
      recipe = new_recipe
      save
    end
  end
end

load should be able to figure out to apply itself, simply because the return value from the block is an AR record.

perhaps its as simple as load applying itself to whatever the block returns!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions