r/learnruby • u/c-r_o • Jan 28 '15
Class.method_b(Class.method_a(arg1, arg2))
This can't be right, but I don't know know how how to ask this question in a way that'll get me help on SO or the like. . . (in a rails app) I'm trying to make a system of methods to help make queries on a database. Some queries returns a hash: Class.method_b(arg1, arg2) = hash and other's I'd like to use to to evaluate those hashes - which is where:
Class.method_a(arg3)comes in. I'm pretty sure this isn't the way to go about it but, like I said, not really sure where to go from here. I had been imagining I'd be able to do something like:
Class.method_b.method_abut I keep getting:
"NoMethodError: undefined method `method_a' for #<Hash:0x007fe893b804b0>. . .little help?
View all comments
Show parent comment
1
u/c-r_o Jan 28 '15
Awesome! I ended up needing to make a subclass in order to play nice with ActiveRecord but now my models and queries are much cleaner. Thanks for taking the time to be helpful and replying to such a noob question - I'd seen all this code before while studying but it never clicked and I had sort of coded myself into a corner mentally.