Hacker News new | ask | show | jobs
Ask HN: Question about Heroku
5 points by jreilly 6355 days ago
So I just started my first ever rails app today and am using the new Heroku garden. Poking around with it now but does anyone know if there is any syntax completion or correction that you can enable? I would love to be able to view all the available methods and things of that nature following a . since I am just getting started but see no such ability.

I know I could install rails on my own machine and use a better editor but any way inside of heroku to do this?

Thanks

1 comments

This kind of thing is really difficult to do in Ruby. (I'm guessing you're looking for something similar to the autocomplete lists you've used in Visual Studio, Eclipse, or another IDE?)

Because classes can have new methods added at runtime, individual objects can have methods added or removed at runtime, and so on and so forth, there's no easy way to reflect and grab that information while you're typing.

Having said that, try the following in irb or script/console (not sure how to do that on Heroku)

>> object.methods.sort

>> object.methods.sort.grep /something/

(where /something/ is a regexp representing the name or part of a name of what you're looking for).

Hope that helps!

I appreciate the feedback. I knew it wouldn't be trivial if it hadn't been implemented but you are exactly right that I was looking for something similar to the list an IDE like IntelliJ or Eclipse used to give me of available methods when I programmed in java.

Anyways thanks for the response and I guess I will have to truly learn ruby.

First Note on Rails: has_and_belongs_to_many is painfully long to type.

Whenever you type that, you usually want has_many :through anyway :)
Let's say i have categories that have many products but many products fit into several categories. Or I have a games with several players but players can play in several games?

Am I wrong to you has_and_belongs_to_many without using has_many :through?

But, it is obviously self-explanatory.