I am using Ruby with Sinatra and Sequel. Now I am trying to create classes for my project, for example the class "User" which should contain "First Name" and "Lastname". When creating an instance of that class it should be possible to directly set the names like new User("Some","name")
.
I am using Sequel to connect to a database and create a class::model like this:
class User < Sequel::Model end
My question is now where would I add a constructor for my class User and define all the variables? As I allready have the Sequel::Model "User" I can not create another class "User" but I can on the other hand not add a constructor to the Sequel::Model class because that would create a new dataset for each instance of the User class, wouldn´t it? I am confused.
If that was a bit difficult to understand here the short version: I have a file containing a class "User" which inherits Sequel::Model. Where would I put the class variables like name or id and methods like "do_something_with_a_specific_user()"?