Closed Faisal-nfl closed 8 years ago
@Faisal-nfl what versions are both projects using?
@mattpolito
The current project in which thing.save
is not working has Version
Ruby : 2.3.1
Rails : 5.0.0
The previous project in which it works Ruby : 2.3.1 Rails : 4.2.6
@Faisal-nfl I'm sorry, I should have been more clear. What version of decent_exposure are you using in both instances.
@mattpolito My bad, should have thought about it In last project it was 2.3.3 and in current project its 3.0.0
hey @Faisal-nfl,
the way a thing
is instantiated is slightly different in version 3.0.0
, so you'll need to change your code to use thing.update(thing_params)
. Something like that:
class ThingsController < ApplicationController
expose :thing
def update
if thing.update(thing_params)
redirect_to thing_path(thing)
else
render :edit
end
end
end
That's the way we currently do: https://github.com/hashrocket/decent_exposure/blob/master/lib/decent_exposure/behavior.rb#L9
I used decent_exposure and its working fine for save but not working for update using
thing.save
but works withthing.update
Where as in another project
thing.save
works for update I also see an tutorial whichthing.save
is used for update. Whats the difference???