Hi Sean,
I haven't seen any good tutorials that will take you through a lot of
what you are talking. Honestly the documentation is pretty dang good,
but only to those that are familiar with ActiveRecord style ORMs.
Extending Sequel::Model with what you described is rather easily.
Warning I haven't tested the code, it might also not match your exact
requirements but it could be a place to start.
class Person < Sequel::Model
def self.search_by_last_name(letter)
where('last_name LIKE ?', 'letter%')
end
end
Person.search_by_last_name('b')
By defining a self method on a class you are saying that it is similar
to a @staticmethod method in Python.
Hope that helps.
On Tue, May 15, 2012 at 12:23 PM, Sean Redmond <[email protected]> wrote:
> I'm new to Sequel and newish to Ruby (but coming with a lot of experience
> in, say, Python) and I'm looking for Sequel tutorials or examples that don't
> skip a lot of steps. Most of what I'm finding kind of jumps over everything
> to the punch line and when I try to recreate the example I can't get it to
> work. I'm trying to figure out things like: If I have a table with people's
> names how to I extend Sequel::Model to add a method that will return all the
> people whose last names begin with a specific letter.
>
> Thanks!
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sequel-talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sequel-talk/-/AQpsWn6VZfwJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sequel-talk?hl=en.
--
—Silas
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.