{"issue":{"state":"closed","created_at":"2011-11-30T23:07:06Z","updated_at":"2011-12-05T15:34:49Z","comments":1,"user":{"gravatar_id":"cf92bbd964597b1f1190fae23e946774","id":1082129,"url":"https://api.github.com/users/blawzoo","avatar_url":"https://secure.gravatar.com/avatar/cf92bbd964597b1f1190fae23e946774?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"blawzoo"},"body":"Hello I'm running into big troubles right now.(please be indulgent, I'm not a seasoned rails coder)\r\n\r\n1-When I create an account, everything works perfectly.\r\n\r\n2-But when it comes to create a transaction, that's when things get tricky.Here's is the code:\r\n\r\n\r\n    def create\r\n\r\n    @transaction = Transaction.new(params[:transaction])\r\n    @transaction.credit_account = Account.where(:type => params[:type]).where(:name => params[:name]) \r\n    @transaction.debit_account =  Account.where(:type => params[:type]).where(:name => params[:name])\r\n\r\n    respond_to do |format|\r\n      if @transaction.save\r\n        format.html { redirect_to @transaction, :notice => 'Facture was successfully created.' }\r\n      else\r\n       format.html { render :action => \"new\" }\r\n     end\r\n    end\r\n    end\r\n\r\nBut when I hit submit i get the following message:\r\n\r\n>ActiveRecord::AssociationTypeMismatch in TransactionsController#create\r\n>Account(#2178411460) expected, got String(#2151988680)\r\n\r\nIf the method is wrong can anyone tell me please, the best way to write this controller?\r\n","assignee":null,"id":2408700,"labels":[],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"number":3,"title":"What'is the best way to implement transaction#create controller","html_url":"https://github.com/mbulat/plutus/issues/3","closed_at":"2011-12-05T15:34:49Z","url":"https://api.github.com/repos/mbulat/plutus/issues/3","milestone":null},"action":"closed"}