notahat / machinist

Fixtures aren't fun. Machinist is.
MIT License
1.12k stars 134 forks source link

link weirdness: wrong number of arguments (1 for 2) #86

Closed ramontayag closed 13 years ago

ramontayag commented 13 years ago

Anyone come across link weirdness with Machinist (pre Rails 3.1)?

I have plan like this:

MenuItem.blueprint do
  link
end

But when I call MenuItem.make I get this error:

wrong number of arguments (1 for 2)

When I remove link it starts to work fine. Machinist also works fine with other fields.

ramontayag commented 13 years ago

I made a new app, and tried it separately. It works. So it's not Machinist - it's some weirdness I gotta figure out.

notahat commented 13 years ago

I'm betting you define a global "link" method somewhere. Try "self.link" in the blueprint, and see if that works.

ramontayag commented 13 years ago

Perhaps. I ended up avoiding it altogether by renaming it to url. When searching for the cause of it, I saw that it's a reserved word anyway. Thanks!

pat commented 13 years ago

I think link is a method inserted into the global scope from Rake.

vertis commented 13 years ago

@notahat's suggestion, to use 'self.link', works well as a workaround