I feel like I’m missing a fundamentally easier way to do this; either way, I don’t appear to have the syntax for array figured out. Trying to stuff things into the params array. Any help is appreciated.
@user = User.find(params[:user][:id])
array_of_match_information = Array.new
array_of_match_information[mentee] = @user.id
array_of_match_information[mentor] = self.id
array_of_match_information[status] = "Pending"
@match = Match.new(params[:array_of_match_information])
Thanks.
EDIT
Hashis a key/value storage, like you intend to do.menteeis a key that will be associated to a value@user_idArray don’t organize data (unless you consider the position in the Array is known and meaningful)
EDIT2:
And correct this:
EDIT3:
I encourage you to have a look at http://railsforzombies.org, it seems you need a good tutorial.
Actually, building an app when you’re learning could be hazardous because when you don’t know basic architecture, you end up overcoding unmaintainable code.
For instance, your line:
seems really weird.