On Oct 20, 8:48 pm, cult hero <[email protected]> wrote:
> > Could you be more specific?  I'm guessing you are referring to the
> > column methods that are autogenerated when the model is created, but
> > those should respect the Database object's identifier_output_method.
>
> I am and they do.
>
> Basically, I'd like to have things work in such a way that a dataset
> uses the literal names of the column but the method name does not.

Well, then you should probably not override the identifier input/
output methods, as that will make the dataset use the translated
names. Instead override Model.def_column_accessor:

  class Sequel::Model
    def def_column_accessor(*columns)
      columns.each do |column|
        meth = "#{column.to_s.underscore}"
        overridable_methods_module.module_eval("def #{meth};
self[:#{column}] end", __FILE__, __LINE__)
        overridable_methods_module.module_eval("def #{meth}=(v);
self[:#{column}] = v end", __FILE__, __LINE__)
      end
    end
  end

> From what you've already said about identifier_output_method, I think
> it's same to assume there's no way to do what I'm asking for right
> now.

Well, there isn't a built-in way, but as you can see, it's fairly easy
to do manually.

Jeremy

-- 
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.

Reply via email to