ruby-on-rails-4.1

Why is Ruby on Rails secrets.yml not loading?

北城余情 提交于 2019-11-30 08:13:39
I am trying to access my secret keys from the config/secrets.yml file. secrets.yml: development: secret_key_base: laksjfla...alskdfjlaksjdflaksd other_secret: password Rails Console: $ rails c > Rails.application.secrets > => {:secret_key_base=>"laksjfla...alskdfjlaksjdflaksd"} Where is my other_secret ?! I've faced a similar problem once, try to reload spring server with bin/spring stop , so the changes to secrets.yml should take effect. then run rails c again. (posting comment as a answer). There is an open pull request here - https://github.com/rails/spring/pull/289 - spring does not watch

rails 4.1 can't deploy via capistrano 3

爷,独闯天下 提交于 2019-11-30 03:38:30
i have very strange error when deploy my rails app with capistrano. sometimes it's deploy and sometimes not. for example i add something to css (just one string) e.g. .my_some_class{width:10px} and after that deployment fails. before i add this - it's deploy ok. i am sure what nothing else changed cause i make experimental commit which contain only one string of css. my config: rails 4.1.0 ruby 2.1.1p76 gem 'capistrano-rails', group: :development gem 'capistrano-rvm', group: :development gem 'capistrano-bundler', group: :development end of deploy log: Tasks: TOP => deploy:assets:precompile

ActionDispatch::Routing::RouteSet#call Rails 4.1 really slow

亡梦爱人 提交于 2019-11-30 01:12:44
I've searched for days but can't find any relevant answers to this question. In my Rails 4.1 app hosted on Heroku, when the load goes up, some PUT requests get REALLY slow. The slowest one today was 53 seconds. All without the database (MongoDB) registering any slow queries. Normally this request takes 0.3ms so pretty fast. The request is slow no matter what the payload is. Upon installing New Relic it shed some more light on the situation, but I still don't know where to fix this problem. The code in the controller is fast, but according to New Relic, the thing that is slow is ActionDispatch:

Wrong color for flash messages under Rails 4.1 with Bootstrap or Foundation

僤鯓⒐⒋嵵緔 提交于 2019-11-30 00:51:30
问题 The following code displays Rails flash messages using Bootstrap 3.0: <%# Rails flash messages styled for Twitter Bootstrap 3.0 %> <% flash.each do |name, msg| %> <% if msg.is_a?(String) %> <div class="alert alert-<%= name == :notice ? "success" : "danger" %>"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <%= content_tag :div, msg, :id => "flash_#{name}" %> </div> <% end %> <% end %> The code is from the article Bootstrap and Rails. Similar code from

validates_inclusion_of no longer working the same in Rails 4.1?

一曲冷凌霜 提交于 2019-11-29 14:31:51
问题 The following code made sure that a time_zone chose is within the time zones in ActiveSupport::TimeZone.us_zones : validates_inclusion_of :time_zone, in: ActiveSupport::TimeZone.zones_map(&:name) Worked great in Rails 4.0. Just upgraded to Rails 4.1 and I'm getting this error on my index page (so just simply viewing the models): An object with the method #include? or a proc, lambda or symbol is required, and must be supplied as the :in (or :within) option of the configuration hash I'm

Why is Ruby on Rails secrets.yml not loading?

谁说我不能喝 提交于 2019-11-29 11:04:57
问题 I am trying to access my secret keys from the config/secrets.yml file. secrets.yml: development: secret_key_base: laksjfla...alskdfjlaksjdflaksd other_secret: password Rails Console: $ rails c > Rails.application.secrets > => {:secret_key_base=>"laksjfla...alskdfjlaksjdflaksd"} Where is my other_secret ?! 回答1: I've faced a similar problem once, try to reload spring server with bin/spring stop , so the changes to secrets.yml should take effect. then run rails c again. (posting comment as a

rails 4.1 can't deploy via capistrano 3

一笑奈何 提交于 2019-11-29 01:08:59
问题 i have very strange error when deploy my rails app with capistrano. sometimes it's deploy and sometimes not. for example i add something to css (just one string) e.g. .my_some_class{width:10px} and after that deployment fails. before i add this - it's deploy ok. i am sure what nothing else changed cause i make experimental commit which contain only one string of css. my config: rails 4.1.0 ruby 2.1.1p76 gem 'capistrano-rails', group: :development gem 'capistrano-rvm', group: :development gem

Rails Spring breaking generators

ぐ巨炮叔叔 提交于 2019-11-29 01:03:43
I'm setting up my first Rails 4.1 app, which comes with Spring, their new preloader. When I try to install Devise using their generator ( $ rails generate devise:install ), the command line just hangs and nothing gets generated. If I remove Spring from the gem file and try again, the Devise generator works. Anyone have any insight? Check directories of some other projects that you were working on at that time, chances are that the generated files ended up there. spring seems to get confused when you work with more than one rails app at a time. That's probably what caused your problem spring

Rails 4 - undefined method `call' when doing a simple query

匆匆过客 提交于 2019-11-28 21:23:50
I'm new to Rails but this seems pretty straightforward. I have a model called Game generated like this: rails generate model Game name:string year:integer manufacturer:string notes:string is_active:boolean I've loaded the table with some data, and I am trying to fetch all of the rows where is_active is true . I'd like my model to be something like: class Game < ActiveRecord::Base scope :active, where(:is_active => 1) end My problem is whenever I try to bind to the Game.active query I get an error. It's the same error in the rails console or if I try to set it to a variable in the controller.

ActionDispatch::Routing::RouteSet#call Rails 4.1 really slow

会有一股神秘感。 提交于 2019-11-28 21:19:07
问题 I've searched for days but can't find any relevant answers to this question. In my Rails 4.1 app hosted on Heroku, when the load goes up, some PUT requests get REALLY slow. The slowest one today was 53 seconds. All without the database (MongoDB) registering any slow queries. Normally this request takes 0.3ms so pretty fast. The request is slow no matter what the payload is. Upon installing New Relic it shed some more light on the situation, but I still don't know where to fix this problem.