I've tried a number of things with no effect. The call to validation
errors is an undefined method. Can you please tell me what I am leaving
out?
And if it's okay to double up, since `def new` instantiates a new Song
object, I wanted to use `set` in `def create_song` and it would not work.
Right now, while it works (minus the validation error issues) it's
essentially creating a new Song object twice. Originally I used insert, so
I replaced it with set, and then save, but no go. Ok, thank you for the
help!
class Song < Sequel::Model
plugin :validation_helpers
self.raise_on_save_failure
def validate
super
validates_presence [:title, :length, :released_on, :lyrics]
end
end
def create_song
begin
@song = Song.create(params[:song])
rescue
flash[:notice] = @song.errors.full_messages
end
end
end
get '/new' do
protected!
@song = Song.new
slim :new_song
end
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.