rea-analysis-optimization
MOmorluto/rea486k近 7 天新增 8,943 个 star
Apply core Ruby on Rails best practices for architecture, naming, safety, and maintainability. Use for most Rails coding, refactoring, and code review tasks so baseline standards stay consistent.
Use this as the default baseline for Rails work. It started from 37signals' codebases (Campfire, Fizzy) and DHH's reviews; the parts that are a matter of taste live in 37signals-style. When the app follows that style (no service objects, CRUD-only routing, records for state), apply both.
dependent: :delete_all when no callbacks needed).params.expect(...) for strong params in modern Rails.create!), handle exceptions at boundaries. Only use ! when a non-bang counterpart exists.enqueue_after_transaction_commit over retry logic for races).normalizes (data cleanup before validation), store_accessor (JSON columns), delegated_type (heterogeneous collections), generates_token_for (expiring signed tokens), string enums via enum :status, %w[drafted published].index_by(&:itself), after_save_commit, touch: true chains for cache invalidation, delegate.insert_all/upsert_all; dependent: :delete_all on join tables with no callbacks.Closure beats CardClose; Mention beats UserReference.active not not_deleted, visible not not_hidden.belongs_to :creator, class_name: "User" not belongs_to :user.quota.depleted? not quota.over_limit?.:active, :unassigned, :golden, not SQL-ish :without_pop.source/resource/container for one concept.resource :archive).resolve "Comment" for polymorphic URL generation to the parent with an anchor.head :forbidden) when access can't be proven.Before adding a gem ask: can vanilla Rails do this? Is a small amount of in-repo code simpler than a dependency you'll have to upgrade?
Comment.find(params[:id]))..map(&:name) where .pluck(:name) works).fresh_when/etag): stale CSRF tokens cause 422s.status == "x") when predicate-style APIs are available (StringInquirer / string enums).validates :x, uniqueness: true without a backing unique index.html_safe strings. Escape first: "<b>#{h(input)}</b>".html_safe.Ship it or a short prioritized fix list.MOmorluto/rea486k近 7 天新增 8,943 个 star
MAmattpocock/skills337k近 7 天新增 4,978 个 star
MAmattpocock/skills337k近 7 天新增 4,978 个 star
MAmattpocock/skills337k近 7 天新增 4,978 个 star
MAmattpocock/skills337k近 7 天新增 4,978 个 star