Skip to content

Commit

Permalink
Initial commit: Simple CRM with Customer model, Active Admin, and cus…
Browse files Browse the repository at this point in the history
…tomer views
  • Loading branch information
QISUN000 committed Feb 27, 2025
1 parent 9efd582 commit ba0ba89
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
Binary file added app/assets/images/default_profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@
*
* Consider organizing styles into separate files for maintainability.
*/
@import "bulma";

/* Custom styles */
.card {
height: 100%;
}

.image.is-96x96 {
margin: 0 auto;
}
9 changes: 9 additions & 0 deletions app/models/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,13 @@ class Customer < ApplicationRecord

validates :full_name, presence: true
validates :email_address, format: { with: URI::MailTo::EMAIL_REGEXP, allow_blank: true }

def self.ransackable_attributes(auth_object = nil)
["created_at", "email_address", "full_name", "id", "notes", "phone_number", "updated_at"]
end

def self.ransackable_associations(auth_object = nil)
["image_attachment", "image_blob"]
end

end
13 changes: 13 additions & 0 deletions config/initializers/active_storage_ransack.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Rails.application.config.to_prepare do
ActiveStorage::Attachment.class_eval do
def self.ransackable_attributes(auth_object = nil)
["blob_id", "created_at", "id", "name", "record_id", "record_type"]
end
end

ActiveStorage::Blob.class_eval do
def self.ransackable_attributes(auth_object = nil)
["byte_size", "checksum", "content_type", "created_at", "filename", "id", "metadata", "service_name"]
end
end
end

0 comments on commit ba0ba89

Please sign in to comment.