The first equation in your answer is correct! It defines the amount of feedback (beta). However - this is only one half of the truth, which means: This is only one part of the voltage which exist as V- at the inverting opamp input.
You must apply superposition when finding the correct value of this voltage V-
because there are two voltage sources contributing to V- :
Feedback part Vr=(beta)=Vout[R1/(R1+R2)], and
Forward part Vf=Vin[R2/(R1+R2)].
Only now you are allowed to set V-=Vr+Vf=0 because both parts contribute to V- :
From this, we get:
Vout[R1/(R1+R2)]=-Vin[R2/(R1+R2)] and:
Vout/Vin=-R2/R1.
Comment 1: Because you were asking about the difference inverting/nin-inverting:
In the NON-inverting case, we have only one source (Vout) which determines the voltage at the inverting termnal (V-) because the input is connected directly to the other input termnal of the opamp.
Comment 2: The transfer function for a system with feedback is
Vout/Vin=Hf[Aol/(1+Aol*Hr)]=Hf/[(1/Aol)+Hr]. For Aol approaching infinite this reduces to
Vout/Vin=Hf/Hr.
Here Hf is a (forward) factor which contains the signal reduction in case the input signal is not connected directly at the opamp input. This is the case for the inverting configuration (EDIT: Hr also contains sign information when effectiv at the inverting input). Therefore: Hf=-R2/(R1+R2)
For a non-inverting circuit the input is normally directly conncted to the pos. input without any signal reduction - hence, Hf=1.
Therefore (non-inverting): Vout/Vin=1/Hr=1/beta.