-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/events #36
Feature/events #36
Conversation
app/helpers/select_helper.rb
Outdated
return unless array.respond_to?(:map) | ||
|
||
array.map { |s| [s.humanize, s] } | ||
array.map { |s| [s.send(transform_func), s] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a respond_to?
check here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
app/models/litigation.rb
Outdated
has_and_belongs_to_many :legislations | ||
|
||
accepts_nested_attributes_for :documents, allow_destroy: true | ||
accepts_nested_attributes_for :litigation_sides, allow_destroy: true | ||
accepts_nested_attributes_for :documents, allow_destroy: true, reject_if: :all_blank |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe:
with_options allow_destroy: true, reject_if: :all_blank do
accepts_nested_attributes_for :documents
accepts_nested_attributes_for :litigation_sides
accepts_nested_attributes_for :events
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
app/models/event.rb
Outdated
validates :event_type, presence: true, inclusion: {in: :valid_types} | ||
|
||
def valid_types | ||
return Litigation::EVENT_TYPES if eventable.is_a?(Litigation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here I would just put eventable.event_types
and leave validation for "eventable" model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validation must be here I guess? but I could add event_types to eventable model sure that's a good idea 👍 but that method must be implemented by all eventables.
All right, I will change that. Documents won't have tab (at least for now), that's only list of links |
Ready again @kowal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏅
No description provided.