So I’m not exactly using Rails, but just ActiveRecord. Though I felt
this would be more appropriate in the Rails forum than the general Ruby
I’m working on an app that interacts with databases, without having a
database of its own.
I have a class called Modeller, and a Modeller#retrieve_model(name)
method that takes a name, looks for a table matching that name, creates
a model that inherits from ActiveRecord::Base and returns it. It works
So I can enter:
m = Modeller.new()
model = m.retrieve_model(‘page’)
And I get back a model called Page, connected to the database and ready
But a problem occurs when I try to call methods on it with
I take a list of fields from a yaml file (user supplied) then attempt to
update the fields with BasicObject#send.
yaml file example -
content: some content
So my code ends up like this:
model.send(‘content’, ‘some content’)
And it blows up with an error:
ArgumentError: wrong number of arguments (1 for 0)
__temp__37964756f59646' /home/zatz/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1 /lib/active_record/attribute_methods.rb:150:inmethod_missing’
And I’m stumped. What’s going on?
A very big thank you ahead of time to whoever can help me figure this
out. I’m totally open to an alternative way of doing this too.