RailsCasts Pro episodes are now free!

Learn more or hide this

Joseph Choi's Profile

GitHub User: josephers

Comments by Joseph Choi

Avatar

Aha. I had the same problem but I realized that the ASCIIcast doesn't have it while the main code does!

Avatar

If you use

ruby
<%= best_in_class_if (logged_in? && post_owner?), @post, :title %>

Then it will render uneditable text if you don't satisfy the if statement.

Avatar

I also had the issues with classify not recognizing singular names like "business", so I went with

ruby
  private
  def find_commentable
    commentable = nil
    params.each do |name, value|
      if name =~ /(.+)_id$/
        commentable = name.humanize.constantize.find(value)
      end
    end
    commentable
  end
Avatar

I read that this is a valid REST response. It's saying that "test" doesn't exist (the username is unique).