How can I compare an entry?
@edit = Data.find(4)
After this, user update some data en press submit.
How can compare, is there any changes in new @edit and what is in
database?
Have user chnged any data or pressed just submit without changes?
How can I compare an entry?
@edit = Data.find(4)
After this, user update some data en press submit.
How can compare, is there any changes in new @edit and what is in
database?
Have user chnged any data or pressed just submit without changes?
On 12 Mar., 18:13, Fresh M. [email protected] wrote:
How can compare, is there any changes in new @edit and what is in
database?
Have user chnged any data or pressed just submit without changes?
Try this in the #update action. It’s untested:
@edited_data = Data.new(params[:data])
@original_data = Data.find(params[:id])
if @edited_data == @original_data
else
end
I don’t know if the == operator works in this case, but try it out and
come back if you get problems.
–
Cheers,
David K.
http://twitter.com/rubyguy
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs