0

I am working with the Salesforce Ruby API which has a pretty good, but slightly dated set up guide. After installing the right gems it says to enter 'script/console' into the command line, and then enter '>> Salesforce::Contact.first' which should respond with a user id.

I have read other's post saying that script/console is no longer being used and to use rails console instead. That works fine, but when I enter '>> Salesforce::Contact.first' it complains that the syntax is wrong.

I also tried removing the >> from the front and it resulted in it saying "The filename, directory name, or volume label syntax is incorrect"

I there some other command besides '>> Salesforce::Contact.first' that I should be using?

Thanks

9
  • try require 'Salesforce' to load the API into the console. Commented Jun 13, 2014 at 18:00
  • 3
    If the guide shows >> in front of all their commands, I'm guessing it is supposed to represent the prompt in the Rails console, so it should not be entered. The error message you wrote makes me think you tried to execute that line from the command line, but not in the Rails console itself. Make sure you're in the console first - make sure you've done rails console first, and then Salesforce::Contact.first second. Commented Jun 13, 2014 at 18:01
  • When I enter rails console it responds with "Usage: rails new APP_PATH [option] Options: ..." And then a whole list of different options. But it doesn't seem like the Rails console actually comes up. (I have never used the rails console before so I am not sure what to look for) Commented Jun 13, 2014 at 18:10
  • 1
    You have to be inside a Rails application's directory before you can use the console. If you haven't started your project, do that first. If you have started your project, cd into it. Commented Jun 13, 2014 at 18:18
  • When I cd into my project and enter rails c, it says rails is not recognized as a command Commented Jun 13, 2014 at 18:32

1 Answer 1

1

>> (and similar things) represent the prompt that you should see already on the screen for you. It's essentially the console saying "Go ahead, type something"

Try to 'mentally' strip stuff like that off from the beginning, including spaces. This would mean that the 'command' you're looking to execute is really,

Salesforce::Contact.first

Hope this helps.

Sign up to request clarification or add additional context in comments.

2 Comments

>> is both the default irb prompt and the Ruby shift operator, so it generates syntax errors when used incorrectly.
Correct, I could understand the confusion, it takes a bit of intuition to be able to determine when code is calling to use a Bitwise Shift or just a prompt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.