Open eadz opened 1 year ago
It looks like order matters here, and the line that determines whether validates :attribute_name
gets scaffolded or not is determined in the Super Scaffolding gem:
is_required = attribute_options[:required] || (scaffolding_options[:type] == :crud && index == 0)
I saw that the order you had for your attributes in your rails g
and bin/super-scaffold crud
commands are different. Maybe we should raise an error at the CLI level if the developer's attributes aren't in the same order when running bin/super-scaffold crud
? It looks like some of the moving parts we have in place depend on at least the first attribute matching when running the commands, so my initial instinct is to handle the issue there.
Hi, I've got a reproducible missing translation error.
I ran the following:
I created a
Page
with a blankslug
, then hit the missing translation error due topage.label_string
being blank, due toslug
being blank.The code that decided that
slug
was the label is the following:Which take the first string field. I did notice that it added a
validates :title, presence: true
to the model but not avalidates :slug, presence: true' I'm assuming the
validates :title, presence: true` was added for the exact reason the bug happened?Maybe this can be solved by the crud generator adding a validation to
label_field
as well? or a documentation change to let people know that the first string field is used for the model's label?