Comments (2)
Hi, I'm getting the same weird behaviour. Any luck? (Rails 4.1.0/Ruby 2.1.1)
from acts_as_relation.
So here's what happens in your case. Do you have cost in your product model? If you do, then what happens is that upon creation of a book, it will run one build model to accommodate for the cost,
@book.product.build
which doesn't recognize the associated model(Store) and the default
@book = @store.book.build
@product = @book.build_product
which recognises the store and not the cost. Remove cost from your product and keep it in your book and you'll be fine. Assuming that you did this to sort by price, for example, you can the build helper methods to help you do this. eg:
@store.products.collect(&:product).sort{|x,y| x.cost <=> y.cost}
If you find out how to sort as a default scope, please let me know
from acts_as_relation.
Related Issues (20)
- Extending Devise's User to Roles using acts_as_relation HOT 1
- Cannot instantiate an subclass HOT 3
- Rails 3.2 - .specific is not working? HOT 1
- PG::UndefinedColumn, ActiveRecord::StatementInvalid HOT 1
- Cannot use created_at or any timestamp columns to query: ambiguous column name HOT 2
- Circular reference issue when running migration HOT 3
- Association field name error (assuming default convension names) HOT 1
- Name of the has_one assiocation HOT 1
- Pen.where(name: "...") doesn't work HOT 1
- Rails 4 + ActiveAdmin compatibility (Migration error) HOT 12
- Dependent Destroy does not work ? HOT 1
- Including a "whole" object in json
- Make record duplication possible
- Saving the parent object doesnt save changes to the child HOT 1
- Move version.rb into acts_as_relation directory HOT 1
- Infinite loop unexistant method/`respond_to?` on `.specific` HOT 1
- PG::Error: ERROR: relation "users" does not exist
- SQL request problem
- Gem dependencies incorrect HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acts_as_relation.