Skip to content

Framgia-ci: Rails_best_practice #3

@thanhhungchu95

Description

@thanhhungchu95

Thưa anh, lúc chạy framgia-ci thì em được kết quả failed tại rails_best_practice. Lỗi thông báo là protect_mass_assignment trong file app/models/application_record.rb:
Nội dung file như sau ạ:
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
Theo như cách sửa được gợi ý trong trang report của rails_best_practice thì ở đoạn code trên chỉ cần thêm attr_accessible hoặc attr_protected cho abstract_class nhưng vấn đề là:

  • attr_accessibleattr_protected này đã bị loại bỏ kể từ Rails 4
  • em có thử thay bằng attr_reader / attr_writer / attr_accessor nhưng đều không pass được rails_best_practice, chỉ có làm theo gợi ý attr_accessible hoặc attr_protected thì mới pass.

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