Running code in RoR won't work



I have a workspace based on the Rails Tutorial, and the follow results in an error:

bash: syntax error near unexpected token '.to_a.shuffle[0..7].join'

Does anyone have a clue as to why this might occur? I’ve copy/pasted the code and have retyped it to make sure to minimize the amount of errors caused on my end.


Based on your error message which says bash, it looks like you are running this ruby/rails command in the bash or command prompt.

You should be running it in the rails console.