After installing spree stable 2.0 version ...
with the sample -products
i am trying to see the way spree works
but on the checkout (step 2:: url ::- /checkout/delivery ) ..
it seems to be giving me error like..
----second step of checkout process --(after clicking on save& continue)
ActiveRecord::RecordNotFound in Spree::CheckoutController#update
Couldn't find Spree::Shipment with ID=45 for Spree::Order with ID=6
----------stack trace... activerecord (3.2.13) lib/active_record/nested_attributes.rb:463:in
raise_nested_attributes_record_not_found' activerecord (3.2.13)
lib/active_record/nested_attributes.rb:428:inblock in
assign_nested_attributes_for_collection_association' activerecord
(3.2.13) lib/active_record/nested_attributes.rb:401:in each'
activerecord (3.2.13)
lib/active_record/nested_attributes.rb:401:inassign_nested_attributes_for_collection_association'
activerecord (3.2.13) lib/active_record/nested_attributes.rb:289:in
shipments_attributes=' activerecord (3.2.13)
lib/active_record/attribute_assignment.rb:94:inblock in
assign_attributes' activerecord (3.2.13)
lib/active_record/attribute_assignment.rb:93:in each' activerecord
(3.2.13)
lib/active_record/attribute_assignment.rb:93:inassign_attributes'
activerecord (3.2.13) lib/active_record/persistence.rb:216:in block in
update_attributes' activerecord (3.2.13)
lib/active_record/transactions.rb:313:inblock in
with_transaction_returning_status' activerecord (3.2.13)
lib/active_record/connection_adapters/abstract/database_statements.rb:192:in
transaction' activerecord (3.2.13)
lib/active_record/transactions.rb:208:intransaction' activerecord
(3.2.13) lib/active_record/transactions.rb:311:in
with_transaction_returning_status' activerecord (3.2.13)
lib/active_record/persistence.rb:215:inupdate_attributes'
/home/sanjeev.kumar/.rvm/gems/ruby-1.9.3-p362/bundler/gems/spree-562f390cbacf/frontend/app/controllers/spree/checkout_controller.rb:25:in
`update'
Related
I’m trying to implement a SMAPI service, but am running into some issues.
I’ve built a “fake” service which gives hard-coded responses for these endpoints:
getMediaURI
getLastUpdate
getMediaMetadata
getMetadata
getExtendedMetadata
getSessionId
I've followed the instructions for adding a custom service, keeping all capabilities unchecked.
I see my new test service listed on my Sonos iPhone app, but when I select it, I get a screen saying "Unable to browse music".
I'm not really sure how to debug what's happening, so feel like I'm stabbing in the dark. I don't want to make changes speculatively that may not be anything to do with the problem - that seems like a recipe for tons of wasted effort.
Is there any way of seeing the errors the Sonos Controller app (client) is having? I've checked out the http://[device ip]:1400/support/aggregate logs, but don't see any mention of my service's domain name, or see anything that seems relevant.
I know that (at least some) requests are hitting my service, specifically call to getLastUpdate and getMetadata. Here's the output of the logs:
2016-02-23T18:55:24.316373+00:00 app[web.1]: Started POST "/soap/action" for 213.86.218.202 at 2016-02-23 18:55:24 +0000
2016-02-23T18:55:24.316485+00:00 app[web.1]: Started POST "/soap/action" for 213.86.218.202 at 2016-02-23 18:55:24 +0000
2016-02-23T18:55:24.431603+00:00 app[web.1]: Processing by SoapController#get_last_update as HTML
2016-02-23T18:55:24.431611+00:00 app[web.1]: Processing by SoapController#get_last_update as HTML
2016-02-23T18:55:24.438452+00:00 app[web.1]: params.inspect: {}
2016-02-23T18:55:24.438458+00:00 app[web.1]: params.inspect: {}
2016-02-23T18:55:24.447855+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/gems/wash_out-0.10.0/app/views/wash_out/document/response.builder (7.6ms)
2016-02-23T18:55:24.447907+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/gems/wash_out-0.10.0/app/views/wash_out/document/response.builder (7.6ms)
2016-02-23T18:55:24.448279+00:00 app[web.1]: Completed 200 OK in 17ms (Views: 9.5ms | ActiveRecord: 0.0ms)
2016-02-23T18:55:24.457801+00:00 app[web.1]: Started POST "/soap/action" for 213.86.218.202 at 2016-02-23 18:55:24 +0000
2016-02-23T18:55:24.448327+00:00 app[web.1]: Completed 200 OK in 17ms (Views: 9.5ms | ActiveRecord: 0.0ms)
2016-02-23T18:55:24.464365+00:00 app[web.1]: Processing by SoapController#get_metadata as HTML
2016-02-23T18:55:24.457861+00:00 app[web.1]: Started POST "/soap/action" for 213.86.218.202 at 2016-02-23 18:55:24 +0000
2016-02-23T18:55:24.464428+00:00 app[web.1]: Processing by SoapController#get_metadata as HTML
2016-02-23T18:55:24.465101+00:00 app[web.1]: params.inspect: {"id"=>"root", "index"=>0, "count"=>100}
2016-02-23T18:55:24.465154+00:00 app[web.1]: params.inspect: {"id"=>"root", "index"=>0, "count"=>100}
2016-02-23T18:55:24.472056+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/gems/wash_out-0.10.0/app/views/wash_out/document/response.builder (3.4ms)
2016-02-23T18:55:24.472049+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/gems/wash_out-0.10.0/app/views/wash_out/document/response.builder (3.4ms)
2016-02-23T18:55:24.472248+00:00 app[web.1]: Completed 200 OK in 8ms (Views: 6.9ms | ActiveRecord: 0.0ms)
2016-02-23T18:55:24.472251+00:00 app[web.1]: Completed 200 OK in 8ms (Views: 6.9ms | ActiveRecord: 0.0ms)
Any help would be hugely appreciated!
UPDATE
Here's the output from making requests against my fake service with SoapUI:
getLastUpdate
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sonos.com/Services/1.1">
<soap:Body>
<tns:getLastUpdateResponse>
<getLastUpdateResult>
<catalog>Catalog last updated 2016-02-18 11:52:30</catalog>
<favorites>User: Rob last updated favorites 2016-02-18 12:01:00</favorites>
<pollInterval>30</pollInterval>
</getLastUpdateResult>
</tns:getLastUpdateResponse>
</soap:Body>
</soap:Envelope>
getSessionId
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sonos.com/Services/1.1">
<soap:Body>
<tns:getSessionIdResponse>
<getSessionIdResult>user0001</getSessionIdResult>
</tns:getSessionIdResponse>
</soap:Body>
</soap:Envelope>
getMetadata
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sonos.com/Services/1.1">
<soap:Body>
<tns:getMetadataResponse>
<getMetadataResult>
<index>0</index>
<count>2</count>
<total>2</total>
<mediaMetadata>
<id>some_id_1</id>
<title>Title 1</title>
<mimeType>audio/mp4</mimeType>
<itemType>track</itemType>
<displayType>List</displayType>
<summary>Summary text 1. Summary text 1. Summary text 1.</summary>
<trackMetadata>
<artistId/>
<artist/>
<composerId/>
<composer/>
<albumId/>
<album/>
<albumArtURI/>
<albumArtistId/>
<albumArtist/>
<genreId/>
<genre/>
<duration/>
<canPlay/>
<canSkip/>
<canAddToFavorites/>
<rating/>
<trackNumber/>
</trackMetadata>
<streamMetadata></streamMetadata>
</mediaMetadata>
<mediaMetadata>
<id>some_id_2</id>
<title>Title 2</title>
<mimeType>audio/mp4</mimeType>
<itemType>track</itemType>
<displayType>List</displayType>
<summary>Summary text 2. Summary text 2. Summary text 2.</summary>
<trackMetadata>
<artistId/>
<artist/>
<composerId/>
<composer/>
<albumId/>
<album/>
<albumArtURI/>
<albumArtistId/>
<albumArtist/>
<genreId/>
<genre/>
<duration/>
<canPlay/>
<canSkip/>
<canAddToFavorites/>
<rating/>
<trackNumber/>
</trackMetadata>
<streamMetadata></streamMetadata>
</mediaMetadata>
</getMetadataResult>
</tns:getMetadataResponse>
</soap:Body>
</soap:Envelope>
getExtendedMetadata
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sonos.com/Services/1.1">
<soap:Body>
<tns:getExtendedMetadataResponse>
<getExtendedMetadataResult>
<mediaMetadata>
<id>some_id_1</id>
<title>Title 1</title>
<mimeType>audio/mp4</mimeType>
<itemType>track</itemType>
<displayType>List</displayType>
<summary>Summary text 1. Summary text 1. Summary text 1.</summary>
<trackMetadata>
<artistId/>
<artist/>
<composerId/>
<composer/>
<albumId/>
<album/>
<albumArtURI/>
<albumArtistId/>
<albumArtist/>
<genreId/>
<genre/>
<duration/>
<canPlay/>
<canSkip/>
<canAddToFavorites/>
<rating/>
<trackNumber/>
</trackMetadata>
<streamMetadata></streamMetadata>
</mediaMetadata>
</getExtendedMetadataResult>
</tns:getExtendedMetadataResponse>
</soap:Body>
</soap:Envelope>
getMediaMetadata
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sonos.com/Services/1.1">
<soap:Body>
<tns:getMediaMetadataResponse>
<getMediaMetadataResult>
<id/>
<title>Fake Track Title</title>
<mimeType>audio/mp4</mimeType>
<itemType>track</itemType>
<displayType/>
<summary/>
<trackMetadata>
<artistId>artist:12345</artistId>
<artist>Bach</artist>
<composerId/>
<composer/>
<albumId/>
<album/>
<albumArtURI>https://sonos.therocketfuel.com/images/istockphoto_1945235_satisfaction.jpg</albumArtURI>
<albumArtistId/>
<albumArtist/>
<genreId/>
<genre>Classical</genre>
<duration>459</duration>
<canPlay>true</canPlay>
<canSkip>true</canSkip>
<canAddToFavorites>false</canAddToFavorites>
<rating/>
<trackNumber/>
</trackMetadata>
<streamMetadata></streamMetadata>
</getMediaMetadataResult>
</tns:getMediaMetadataResponse>
</soap:Body>
</soap:Envelope>
getMediaURI
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sonos.com/Services/1.1">
<soap:Body>
<tns:getMediaURIResponse>
<getMediaURIResult>https://sonos.therocketfuel.com/audio/960bpm.m4a</getMediaURIResult>
</tns:getMediaURIResponse>
</soap:Body>
</soap:Envelope>
Have you tried using SoapUI, adding your endpoint and hitting it directly to see what you are getting back?
The solution
I finally figured it out, and essentially my service was returning valid XML, but that wasn't correct for the WSDL schema.
I debugged this by using SoapUI as follows:
Create a new SOAP project
Project name: whatever you like
Initial WSDL: points to where your service serves up the WSDL
Check both "Create Requests" and "Create TestSuite"
Ctrl-click (right-click) on the TestSteps folder and click to "Add Step", then select "SOAP Request"
Give it any name you like (I used e.g. actionName_validate)
Choose the SOAP operation/action you want to validate
Make sure you tick the checkbox for "Add Schema Assertion (adds validation that response complies with its schema)" and click OK
Double-click your newly created test step from the list on the left and run it (click the green play button at the top left)
If your service's response complies with the WSDL, you'll see a green circle at the bottom left where it says "Assertions". If not, it will be red and it will give you a complete list of everything that's wrong with your response.
Fix any problems with your schema one by one until it's green
Extra details if you're using Ruby
Also, here's some more details that may help someone in this situation, specifically if you're building your service in Ruby...
The tooling around SOAP services in Ruby is not as good as in Java (or even PHP). I was using the wash_out gem which, whilst good for a completely new SOAP service, isn't expressive enough to allow you to define type mappings etc that match the official Sonos WSDL. I also couldn't manage to get it to generate the correct XML responses (it missed off a key xmlns attribute needed, or wouldn't namespace all the elements.)
I got round this by manually serving up the XML responses with templates as this was the simplest approach at first. You can use .xml.erb templates or alternatively use xml builder syntax with .xml.builder templates. Really though, you can generate the XML any way you want e.g. to_xml or some other presenter type library.
For the WSDL, I switched to using the official Sonos SMAPI WSDL, and just changing the service address right at the bottom to point to where this modified WSDL is served up by my service.
If any anyone working in visual studio on c#, we use rich textbox on it for comments or Description.
Now I am working ruby on rails and I want to use rich textbox in it.
And I use below code:
<%= f.text_field :manager_emal,placeholder: "" %>
and its show me simple textbox. How do I use rich textbox in ruby on rails.
Kindly suggest me, waiting for reply.
Thanks.
Use this:
<%= f.text_area :Comments, placeholder: "Please input your comments", :size =>"45x2", :style => "font-size:small;" %>
I'm composing a dynamic SQL query that contains named parameters, one of the them is signerName. It's used in the query as the following:
"LOWER(`CG_TRANSACTIONSIGNER`.`FIRSTNAME`) LIKE :signerName"
When setting the parameter as params.put("signerName", signerName);, the Query::executeWithMap(Map parameters) method will return a collection of [Ljava.lang.Object; which is wrong. It's supposed to return a collection of Transaction. This is the complete stack trace:
org.datanucleus.jdo.exceptions.ClassNotPersistenceCapableException: The class "The class "[Ljava.lang.Object;" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found." is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data for the class is not found.
at org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:241)
at org.datanucleus.jdo.JDOPersistenceManager.jdoDetachCopy(JDOPersistenceManager.java:1110)
at org.datanucleus.jdo.JDOPersistenceManager.detachCopyAll(JDOPersistenceManager.java:1183)
at org.datanucleus.jdo.JDOPersistenceManagerProxy.detachCopyAll(JDOPersistenceManagerProxy.java:166)
at com.cryptolog.universign.sign.impl.ContractSignStore.getTransactionsBySQL(ContractSignStore.java:274)
at com.cryptolog.universign.sign.impl.ContractSignStoreTest.testSqlFilterEquivalentToJdqlFilter(ContractSignStoreTest.java:531)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
NestedThrowablesStackTrace:
The class "[Ljava.lang.Object;" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found.
org.datanucleus.exceptions.ClassNotPersistableException: The class "[Ljava.lang.Object;" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found.
at org.datanucleus.ObjectManagerImpl.assertClassPersistable(ObjectManagerImpl.java:3890)
at org.datanucleus.ObjectManagerImpl.detachObjectCopy(ObjectManagerImpl.java:1840)
at org.datanucleus.jdo.JDOPersistenceManager.jdoDetachCopy(JDOPersistenceManager.java:1105)
at org.datanucleus.jdo.JDOPersistenceManager.detachCopyAll(JDOPersistenceManager.java:1183)
at org.datanucleus.jdo.JDOPersistenceManagerProxy.detachCopyAll(JDOPersistenceManagerProxy.java:166)
at com.cryptolog.universign.sign.impl.ContractSignStore.getTransactionsBySQL(ContractSignStore.java:274)
at com.cryptolog.universign.sign.impl.ContractSignStoreTest.testSqlFilterEquivalentToJdqlFilter(ContractSignStoreTest.java:531)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
I figured out what was going wrong. Actually the result returned by the Query::executeWithMap(Map parameters), the collection of [Ljava.lang.Object;, is a normal result. the [Ljava.lang.Object; type is an array of java.lang.Object which was the result of executing the SQL query. This type is not persistable and that's why the ClassNotPersistenceCapableException exception will be thrown when calling the PersistenceManager::detachCopy(Transaction pc) method.
I have the following code in views/posts/show.html.erb:
<span><%= #post.time_ago_in_words(Time.now) %></span><br />
And I get this error:
undefined method `time_ago_in_words' for #<Post:0xac200b0>
Any suggestions to fix this?
time_ago_in_words is an Helper. It's not an ActiveModel instance method. So you have to call it this way(the field is up to you):
<span><%= time_ago_in_words(#post.created_at) %></span><br />
By the way, calculating this kind of stuff is not a best practise. I recommend you to take a look at a solution like jquery.timeago.
Assuming the date of the post is date_posted, try:
<span><%= time_ago_in_words(Time.now - #post.date_posted) %></span><br />
This is a pretty weird error bust basically I just moved my app from sqlite3 to postgreSQL. I use the devise ruby gem to handle session management for users. I'm using rails 3.1.0.rc4 and Devise 1.4.2. Anyway, trying to sign in produces this error:
Started POST "/users/sign_in" for 127.0.0.1 at 2011-07-13 11:32:11 +0100
Processing by Devise::SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"tV0DGHLx0vpTz1/1preLrTvNXpm5LpcNsQeWYJGxZcE=", "user"=>{"email"=>"user#user.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
User Load (0.4ms) SELECT DISTINCT "users".id, FROM "users" LEFT OUTER JOIN "memberships" ON "memberships"."member_id" = "users"."id" LEFT OUTER JOIN "teams" ON "teams"."id" = "memberships"."team_id" WHERE "users"."email" = 'user#user.com' LIMIT 1
PGError: ERROR: syntax error at or near "FROM"
LINE 1: SELECT DISTINCT "users".id, FROM "users" LEFT OUTER JOIN "...
^
: SELECT DISTINCT "users".id, FROM "users" LEFT OUTER JOIN "memberships" ON "memberships"."member_id" = "users"."id" LEFT OUTER JOIN "teams" ON "teams"."id" = "memberships"."team_id" WHERE "users"."email" = 'user#user.com' LIMIT 1
Completed 500 Internal Server Error in 187ms
ActiveRecord::StatementInvalid (PGError: ERROR: syntax error at or near "FROM"
LINE 1: SELECT DISTINCT "users".id, FROM "users" LEFT OUTER JOIN "...
^
: SELECT DISTINCT "users".id, FROM "users" LEFT OUTER JOIN "memberships" ON "memberships"."member_id" = "users"."id" LEFT OUTER JOIN "teams" ON "teams"."id" = "memberships"."team_id" WHERE "users"."email" = 'user#user.com' LIMIT 1):
Here's the framework trace:
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/postgresql_adapter.rb:958:in `async_exec'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/postgresql_adapter.rb:958:in `exec_no_cache'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/postgresql_adapter.rb:547:in `block in exec_query'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract_adapter.rb:222:in `block in log'
activesupport (3.1.0.rc4) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract_adapter.rb:217:in `log'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/postgresql_adapter.rb:546:in `exec_query'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/postgresql_adapter.rb:1027:in `select'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract/database_statements.rb:9:in `select_all'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `block in select_all'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract/query_cache.rb:74:in `cache_sql'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
activerecord (3.1.0.rc4) lib/active_record/base.rb:473:in `find_by_sql'
activerecord (3.1.0.rc4) lib/active_record/relation.rb:109:in `to_a'
activerecord (3.1.0.rc4) lib/active_record/relation.rb:14:in `collect'
activerecord (3.1.0.rc4) lib/active_record/relation/finder_methods.rb:251:in `construct_limited_ids_condition'
activerecord (3.1.0.rc4) lib/active_record/relation/finder_methods.rb:236:in `apply_join_dependency'
activerecord (3.1.0.rc4) lib/active_record/relation/finder_methods.rb:225:in `construct_relation_for_association_find'
activerecord (3.1.0.rc4) lib/active_record/relation/finder_methods.rb:204:in `find_with_associations'
activerecord (3.1.0.rc4) lib/active_record/relation.rb:109:in `to_a'
activerecord (3.1.0.rc4) lib/active_record/relation.rb:127:in `to_a'
activerecord (3.1.0.rc4) lib/active_record/relation/finder_methods.rb:370:in `find_first'
activerecord (3.1.0.rc4) lib/active_record/relation/finder_methods.rb:122:in `first'
activerecord (3.1.0.rc4) lib/active_record/relation/finder_methods.rb:119:in `first'
activerecord (3.1.0.rc4) lib/active_record/base.rb:444:in `first'
orm_adapter (0.0.5) lib/orm_adapter/adapters/active_record.rb:51:in `find_first'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/bundler/gems/devise-e9c766277d61/lib/devise/models/authenticatable.rb:109:in `find_for_authentication'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/bundler/gems/devise-e9c766277d61/lib/devise/models/database_authenticatable.rb:115:in `find_for_database_authentication'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/bundler/gems/devise-e9c766277d61/lib/devise/strategies/database_authenticatable.rb:8:in `authenticate!'
warden (1.0.4) lib/warden/strategies/base.rb:53:in `_run!'
warden (1.0.4) lib/warden/proxy.rb:311:in `block in _run_strategies_for'
warden (1.0.4) lib/warden/proxy.rb:306:in `each'
warden (1.0.4) lib/warden/proxy.rb:306:in `_run_strategies_for'
warden (1.0.4) lib/warden/proxy.rb:279:in `_perform_authentication'
warden (1.0.4) lib/warden/proxy.rb:113:in `authenticate!'
/Users/davidtuite/.rvm/gems/ruby-1.9.2-head#grouperty/bundler/gems/devise-e9c766277d61/app/controllers/devise/sessions_controller.rb:14:in `create'
actionpack (3.1.0.rc4) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.1.0.rc4) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.1.0.rc4) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.1.0.rc4) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.1.0.rc4) lib/active_support/callbacks.rb:434:in `_run__3680065931087317103__process_action__4396720641089604323__callbacks'
activesupport (3.1.0.rc4) lib/active_support/callbacks.rb:386:in `_run_process_action_callbacks'
activesupport (3.1.0.rc4) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.0.rc4) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.1.0.rc4) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.1.0.rc4) lib/active_support/notifications.rb:55:in `block in instrument'
activesupport (3.1.0.rc4) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.0.rc4) lib/active_support/notifications.rb:55:in `instrument'
actionpack (3.1.0.rc4) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.1.0.rc4) lib/action_controller/metal/params_wrapper.rb:202:in `process_action'
actionpack (3.1.0.rc4) lib/action_controller/metal/rescue.rb:17:in `process_action'
activerecord (3.1.0.rc4) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.1.0.rc4) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.1.0.rc4) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.1.0.rc4) lib/action_controller/metal.rb:193:in `dispatch'
actionpack (3.1.0.rc4) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.1.0.rc4) lib/action_controller/metal.rb:236:in `block in action'
actionpack (3.1.0.rc4) lib/action_dispatch/routing/route_set.rb:65:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/routing/route_set.rb:65:in `dispatch'
actionpack (3.1.0.rc4) lib/action_dispatch/routing/route_set.rb:29:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/routing/mapper.rb:41:in `call'
rack-mount (0.8.1) lib/rack/mount/route_set.rb:152:in `block in call'
rack-mount (0.8.1) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.8.1) lib/rack/mount/code_generation.rb:75:in `optimized_each'
rack-mount (0.8.1) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.8.1) lib/rack/mount/route_set.rb:141:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/routing/route_set.rb:531:in `call'
warden (1.0.4) lib/warden/manager.rb:35:in `block in call'
warden (1.0.4) lib/warden/manager.rb:34:in `catch'
warden (1.0.4) lib/warden/manager.rb:34:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.3.0) lib/rack/etag.rb:23:in `call'
rack (1.3.0) lib/rack/conditionalget.rb:35:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/middleware/flash.rb:243:in `call'
rack (1.3.0) lib/rack/session/abstract/id.rb:195:in `context'
rack (1.3.0) lib/rack/session/abstract/id.rb:190:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/middleware/cookies.rb:321:in `call'
activerecord (3.1.0.rc4) lib/active_record/query_cache.rb:54:in `call'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (3.1.0.rc4) lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
activesupport (3.1.0.rc4) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.0.rc4) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/middleware/reloader.rb:68:in `call'
rack (1.3.0) lib/rack/sendfile.rb:102:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.1.0.rc4) lib/rails/rack/logger.rb:13:in `call'
rack (1.3.0) lib/rack/methodoverride.rb:24:in `call'
rack (1.3.0) lib/rack/runtime.rb:17:in `call'
activesupport (3.1.0.rc4) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.0) lib/rack/lock.rb:34:in `call'
actionpack (3.1.0.rc4) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.1.0.rc4) lib/rails/engine.rb:438:in `call'
railties (3.1.0.rc4) lib/rails/rack/content_length.rb:16:in `call'
railties (3.1.0.rc4) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.3.0) lib/rack/handler/webrick.rb:59:in `service'
/Users/davidtuite/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/davidtuite/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/davidtuite/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Is this an ActiveRecord bug or something?
The issue is caused by the fact that I'm trying to eager load teams with users:
class User < ActiveRecord::Base
has_many :teams
default_scope :include => :teams
end
Issue is on Github now. Should be fixed in the next Rails RC.
Can you add in you question information about schema db from db/schema.rb for tables: users, memberships and teams?