Please anyone tell me why we use new!
or create!
in rails controller?
Example==>
def new
new! do |format|
format.html {
set_group_and_class_autocomplete_data_sources(@node)
}
end
end
def create
create! do |success, failure|
failure.html {
set_group_and_class_autocomplete_data_sources(@node)
render :new
}
end
end
The create!, update_attributes! are methods that raises exceptions if the record is invalid.
Check this out:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.