any idea what's wrong here: agreement return either 0 or 1
def select
@imitem = Imitem.find(params[:id])
if [params[:agreement] == 'True']
This isn't bash [params[:agreement] == 'True'] is an array
containing one element, this isn't nil or false and so is always
handled as true by the if. Remove the outer square brackets and you
should be ok.
Well I removed those ie. its now (agreement value on database is
either 1 or 0)
if params[:agreement] == 'True'
redirect_to :action => 'agreement', :id => @imitem and return
else
redirect_to :action => 'options', :id => @imitem and return
end
end
agreement on database has value either 0 (zero) or 1 (one). Now I try
to check if that value is 1 (true) and then it should
take route (action) to agreement and if not then route (action) should
go to options.
I tested with all possible values like: True / true / 1 ... but all
those fails...
is that whole statement then wrong somehow... I am still waiting good
book and its hard to find proper examples from the net.