Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Greg Blass's Profile

GitHub User: gregblass

Site: http://www.phillydevshop.com

Comments by Greg Blass

Avatar

Here's what I ended up doing to test my models. Other thoughts and ideas are welcome (like a shared example to use on all account scoped models based on this gist)

ruby
  let(:account1)     { create(:account) }
  let(:account2)     { create(:account) }
  let(:transaction1) { create(:transaction, account: account1, user: account1.owner) }
  let(:transaction2) { create(:transaction, account: account2, user: account2.owner) }

  describe "default scope" do
    context "query with no account set" do
      it "returns an empty array" do
        expect(Transaction.all).to be_empty
      end
    end

    context "query in account1" do
      it "returns only account1's transaction" do
        Account.current_id = account1.id
        expect(Transaction.all).to eq [transaction1]
      end
    end

    context "query in account2" do
      it "returns only account2's transaction" do
        Account.current_id = account2.id
        expect(Transaction.all).to eq [transaction2]
      end
    end
  end
Avatar

The answer is:

.join("
").html_safe

Avatar

Same here. Hit a dead end because of this.

Avatar

Also looking for an answer as to how I can allow for multiple uploads attached to one object (nested attributes). Although its been asked about 20 times already...I'll ask it again, has anyone found a solution?

Avatar

I'm getting this one as well. Does anyone know how to address this?

I'm trying to run:

task :set_file_permissions do
run "chmod -R 777 #{release_path}/public/uploads"
run "chmod -R 0666 #{release_path}/log/production.log"
end

Getting the same errors as above.

Avatar

Has anyone figured out how to insert a new line in a cell using the Microsoft XML approach?