Comments (3)
Show me relevant parts of your Post
model and controller. Does it work as expected in production mode? I suspect that your scope for retrieving posts is not defined properly. I guess you have something like this in your post.rb
:
class Post
scope :current_locale, where(:locale => I18n.locale)
end
This won't work because the condition is not evaluated every time. Instead it is evaluated only once when your class is loaded and without active_reload
it happens during every request and that's why it works in development mode but won't work in production mode. You need this:
class Post
def self.current_locale
where(:locale => I18n.locale)
end
end
This is similar to : http://edgeguides.rubyonrails.org/active_record_querying.html#working-with-times . You need to either use lambda syntax or define the scope as a class method. Otherwise it won't work in production mode.
That will be my guess without seeing your code. Tell me if I am right.
from active_reload.
Yes, you are right! I have scope :current_locale, where(:locale => I18n.locale)
in my Post model. My bad. Sorry. Thanks for the clarification.
from active_reload.
Thanks for using active_reload
. I hope that now it will work well for you.
from active_reload.
Related Issues (13)
- Add support for ruby 1.8.7 (undefined method `source_location' for Proc) HOT 3
- Test with 3.0.10rc HOT 1
- including active_reload in a 3.1 app drastically increases overall page loading HOT 2
- Clear cache for assets too? HOT 1
- prepare called even when not cleaned HOT 1
- Missing licensing information HOT 2
- incompatible with rails 3.2 HOT 3
- activeadmin HOT 6
- Null exception Rails 3.1.rc4/Ruby 1.9.2-p290 HOT 13
- Invalid Gemspec HOT 4
- Error message on load HOT 2
- Test with Rails 3.1.0.rc5 HOT 2
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 active_reload.