1

I am using that problem that nothing gets saved on my server that uses PostgreSQL.

I have this action here, that updates a boolean it works on my local machine that uses mySQL:

def reel_online

    @movie = Photographer.find(params[:id])

    if @movie.reel_online == false
      @movie.update_attributes(:reel_online => true)
    else
      @movie.update_attributes(:reel_online => false)
    end

    render :nothing => true
end

The strange thing is that with firebug I can see there is no error on the server, but the boolean dos not get changed.

UPDATE: I changed my action to:

def reel_online

    @movie = Photographer.find(params[:id])

    if @movie.reel_online == 'f'
      @movie.update_attributes(:reel_online => 't')
    else
      @movie.update_attributes(:reel_online => 'f')
    end

    render :nothing => true
end

Still there is no error but the boolean is not saved. And my count of true reel_online is 0: <%= @movies.where(:reel_online => 't').count %> In my MySQL database I have set all reel_online to 0

6
  • Possible duplicate of stackoverflow.com/questions/6109060/… Commented Oct 15, 2011 at 10:45
  • I have updated my question still have problems. Commented Oct 15, 2011 at 10:59
  • By the way, a better way to write that would be @movie.update_attributes(:reel_online => [email protected]_online). Just a tip. Commented Oct 15, 2011 at 11:57
  • It's just more concise. Not a big deal really, just thought I'd point it out. Commented Oct 15, 2011 at 12:07
  • what does [email protected]_online do? Commented Oct 15, 2011 at 12:26

1 Answer 1

1

The problem is that in my controller I should use true and false and in view it should be:

<%= @movies.where(:reel_online => 't').count %>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.