I discovered from here that if you have a script you want to run in the rails console, you sometimes have to copy paste it line by line (copy pasting it all at once doesn't always work)
This is very tedious for lengthy scripts
Is there a work around or faster way?
Example - this will not copy paste from text editor to console:
class Article
def initialize(title, link, paragraphs)
@title = title
@link = link
@paragraphs = paragraphs
end
attr_reader :title
attr_reader :link
attr_reader :paragraphs
end
Edit The above snipped does copy paste right into the rails console. But when I grab the same text from sublime text 3, it errors after the second line, with: Display all 522 possibilities? (y or n)..
The Answer I worked out why. My script (in sublime text) used tabs as indents. The rails console only accepts spaces as indents. That's an hour of my life I won't get back. I hope this saves someone else some time.