Loading 0 Votes - +

What Irritates Me About Rails

This is what irritates me about Rails. It’s almost as if it does this to me personally.

include? is just a Ruby instance method for Array. It should work just fine.

That’s what I assumed. All three examples did it but when I dumped the output to the console, it sure returned false every single time.

And if you had to define something like feature_present? you should do it in the model as it has nothing to do with the view

Another point of annoyance – it was in the model but when I’d call it (with various permutations of it being feature_present?, Car.feature_present? or car.feature_present? Rails always threw an error saying it was an undefined method. In the helper, it found it.

Yeah, it should be that easy. All update_attributes does is assign the given hash as the value of obj.attributes.

Once again Rails gave me the shaft here. No matter how many times it was written the way the examples did it, the checked checkmark values were never appearing in that hash sent to the update action. I only saw them when I changed it which caused me to have a second hash which in turn caused me to have to save them manually.

car_feature.feature

Minor point: That’s poor naming.

Well, at least there the original doesn’t look like that … ‘twas a factor of porting over between screens and making it look like something else. One of those "don’t ask why" kind of things.

I would first try refactoring to remove the unnecessary methods and stick with the stuff that Ruby/Rails provides.

I’m going to give it another go … but damn if its annoying that these things give me so many errors when I do it their way. Recoding it always annoys me because I know it deviates from their way but it gets me working so much sooner.

For example, if you’re almost always going to sort feature names, then add :order to your model association declaration

Now that’s cool – I can definitely make use of that!

Your Comment



What is OmniNerd?

Omninerd_icon Welcome! OmniNerd's content is generated by nerds like you. Learn more.

Voting Booth

Dzhokar Tsarnaev deserves due process?

33 votes, 4 comments