Substring first name from ", :address)". How?

I would like to get the first name from :name field below, how do I do
with numerous fields returned?, :address).where({ id: params[:seller_id]})

You need some idea of the form of :name. Lets assume it’s a whitespace
separated string like “Brandon Q. Public”. You could simply use ruby’s
String.split. Of course if some users are royalty you could end up with
lots of users named “Sir” or “Princess”.

The issue was I was kind of stuck with having to use ‘name’ because my
PhoneGap app was calling it.

So I ended up calling a set_name method before returning the JSON.
for your help!

def set_name =’ ').first

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs