ruby-on-rails-3.1

How to stop a heroku server?

一个人想着一个人 提交于 2021-02-07 03:22:33
问题 I have a staging server hosted on heroku, I just want to bring it down, but not destroy the app. How can I do it? Do I have any command like 'heroku stop' like 'heroku restart' for restarting? OR Is there a way to automate the server to turn off itself when it exceeds the 750 hr free usage? Actually I don't want the server so I am trying to stop it, or leave it for the free hours. 回答1: You can scale individual non-web processes down to zero quite happily: $ heroku ps:scale worker=0 $ heroku

How to stop a heroku server?

 ̄綄美尐妖づ 提交于 2021-02-07 03:20:29
问题 I have a staging server hosted on heroku, I just want to bring it down, but not destroy the app. How can I do it? Do I have any command like 'heroku stop' like 'heroku restart' for restarting? OR Is there a way to automate the server to turn off itself when it exceeds the 750 hr free usage? Actually I don't want the server so I am trying to stop it, or leave it for the free hours. 回答1: You can scale individual non-web processes down to zero quite happily: $ heroku ps:scale worker=0 $ heroku

New Image not Rendering in Rails 3.1

青春壹個敷衍的年華 提交于 2021-01-28 09:06:31
问题 I have just added a new loading wheel to my site in assets/images/loading.gif. The gif does work in development, but in production, the browser renders a broken image icon, with no errors. The server is showing the file as 0 bytes, but when I locate the file in the terminal, I can see that it is 3.2k. Other images from assets/images do work. After searching, I tried several things including precompile and changing lines in my config, but as yet, none have worked. Could it be a permissions or

after_destroy callback order in Rails

萝らか妹 提交于 2020-12-30 13:33:36
问题 I am using PostgreSql as database and Rails 3.1.3 and ruby 1.9.3 I have 3 models. Activity ActivityObject ActivityObjectActivity They are related this way. Activity has_many :activity_object_activities,:dependent => :destroy has_many :activity_objects, :through => :activity_object_activities after_destroy :do_something_on_activity_object_related ActivityObject has_many :activity_object_activities, :dependent => :destroy has_many :activities, :through => :activity_object_activities

after_destroy callback order in Rails

放肆的年华 提交于 2020-12-30 13:22:51
问题 I am using PostgreSql as database and Rails 3.1.3 and ruby 1.9.3 I have 3 models. Activity ActivityObject ActivityObjectActivity They are related this way. Activity has_many :activity_object_activities,:dependent => :destroy has_many :activity_objects, :through => :activity_object_activities after_destroy :do_something_on_activity_object_related ActivityObject has_many :activity_object_activities, :dependent => :destroy has_many :activities, :through => :activity_object_activities

after_destroy callback order in Rails

元气小坏坏 提交于 2020-12-30 13:16:48
问题 I am using PostgreSql as database and Rails 3.1.3 and ruby 1.9.3 I have 3 models. Activity ActivityObject ActivityObjectActivity They are related this way. Activity has_many :activity_object_activities,:dependent => :destroy has_many :activity_objects, :through => :activity_object_activities after_destroy :do_something_on_activity_object_related ActivityObject has_many :activity_object_activities, :dependent => :destroy has_many :activities, :through => :activity_object_activities

after_destroy callback order in Rails

孤街浪徒 提交于 2020-12-30 13:13:59
问题 I am using PostgreSql as database and Rails 3.1.3 and ruby 1.9.3 I have 3 models. Activity ActivityObject ActivityObjectActivity They are related this way. Activity has_many :activity_object_activities,:dependent => :destroy has_many :activity_objects, :through => :activity_object_activities after_destroy :do_something_on_activity_object_related ActivityObject has_many :activity_object_activities, :dependent => :destroy has_many :activities, :through => :activity_object_activities

after_destroy callback order in Rails

荒凉一梦 提交于 2020-12-30 13:09:21
问题 I am using PostgreSql as database and Rails 3.1.3 and ruby 1.9.3 I have 3 models. Activity ActivityObject ActivityObjectActivity They are related this way. Activity has_many :activity_object_activities,:dependent => :destroy has_many :activity_objects, :through => :activity_object_activities after_destroy :do_something_on_activity_object_related ActivityObject has_many :activity_object_activities, :dependent => :destroy has_many :activities, :through => :activity_object_activities

Reprocessing images in Carrierwave

早过忘川 提交于 2020-07-04 07:24:29
问题 Let's say my model has an image with :thumb and the client wants :tiny and :nano thumbnails. How do I reprocess all the existing images using a rake task? I've found a rake task that I thought would do it https://gist.github.com/777788 but it's giving me errors. 回答1: According to the Carrerwave documentation you can use following commands: Model.all.each do |model| model.image.recreate_versions! end 回答2: I wanted to expand on this great answer by Mikhail Nikalyukin To Reprocess a single

Rename session cookies in Rails

眉间皱痕 提交于 2020-05-29 02:31:53
问题 since I'd like the session cookie to reflect the url and not the app name, I'd like to rename the cookies.. The current session cookie name is called _APPNAME_session is there a way to rename it to _somethingelse_session ? I see the name of it when I do curl -i <appurl> I see set_cookie = _APPNAME_session=.... 回答1: In config/initializers/session_store.rb, set/change the following line: For Rails < 5.0.0: <APPNAME>::Application.config.session_store :cookie_store, key: '_somethingelse_session'