ruby-on-rails-5

ActionCable NoMethod Error

你。 提交于 2020-01-17 07:05:33
问题 I've added simple ActionCable to my toy rails app and discovered that I'm getting Error: ProductsControllerTest#test_should_update_product: NoMethodError: undefined method server' for ApplicationCable:Module app/controllers/products_controller.rb:53:in block in update' app/controllers/products_controller.rb:44:in `update' test/controllers/products_controller_test.rb:44:in `block in <class:ProductsControllerTest>' when I start my rails unit tests. It's the only time when error occurs. My code:

ActionCable NoMethod Error

与世无争的帅哥 提交于 2020-01-17 07:05:01
问题 I've added simple ActionCable to my toy rails app and discovered that I'm getting Error: ProductsControllerTest#test_should_update_product: NoMethodError: undefined method server' for ApplicationCable:Module app/controllers/products_controller.rb:53:in block in update' app/controllers/products_controller.rb:44:in `update' test/controllers/products_controller_test.rb:44:in `block in <class:ProductsControllerTest>' when I start my rails unit tests. It's the only time when error occurs. My code:

Custom fonts in rails 5 app and Heroku

删除回忆录丶 提交于 2020-01-16 16:26:21
问题 can you please instruct me on how to add custom fonts to my rails 5 application? i've added my custom fonts files to fonts folder in app/assets. i went on to use the @fontface and font-url in .scss , but my fonts wont take effect after before and[enter image description here pushing to heroku. enter image description here 回答1: I suggest you go modify your application.html and add the fonts there. I don't know what you are trying to do but adding a simple <link href="fonts.googleapis.com/css

Custom fonts in rails 5 app and Heroku

醉酒当歌 提交于 2020-01-16 16:26:00
问题 can you please instruct me on how to add custom fonts to my rails 5 application? i've added my custom fonts files to fonts folder in app/assets. i went on to use the @fontface and font-url in .scss , but my fonts wont take effect after before and[enter image description here pushing to heroku. enter image description here 回答1: I suggest you go modify your application.html and add the fonts there. I don't know what you are trying to do but adding a simple <link href="fonts.googleapis.com/css

Button_tag not working inside table in Rails

﹥>﹥吖頭↗ 提交于 2020-01-16 12:00:14
问题 I have the following button_tag inside a form in a table : <div class="table-responsive tableBG"> ** If I move the button here, it works perfectly ** <table class="table table-striped table-sm table-mini"> <thead class="thead"> <tr> <th>...</th> </tr> </thead> <tbody> <tr>...</tr> ... <%= form_for article, :html => {:class => 'toggle'} do |f| %> <%= f.hidden_field :disable, value: true %> <%= button_tag type: 'submit', class: "btn-mini" do %> <i class="fa fa-eye-slash" aria-hidden="true"></i>

Button_tag not working inside table in Rails

自古美人都是妖i 提交于 2020-01-16 11:58:32
问题 I have the following button_tag inside a form in a table : <div class="table-responsive tableBG"> ** If I move the button here, it works perfectly ** <table class="table table-striped table-sm table-mini"> <thead class="thead"> <tr> <th>...</th> </tr> </thead> <tbody> <tr>...</tr> ... <%= form_for article, :html => {:class => 'toggle'} do |f| %> <%= f.hidden_field :disable, value: true %> <%= button_tag type: 'submit', class: "btn-mini" do %> <i class="fa fa-eye-slash" aria-hidden="true"></i>

Sidekiq Broken Pipe Error

只谈情不闲聊 提交于 2020-01-15 10:43:15
问题 I am attempting to migrate from Heroku to AWS, but my Sidekiq jobs keep failing with the following error: Errno::EPIPE: Broken pipe @ io_write - <STDOUT> I can successfully run jobs from the console using perform_now , and everything works just fine in Heroku, so I am presuming the issue lies somewhere with my AWS setup. I have seen references to improper daemonization around Stack Overflow and Github but not sure how to solve the problem. Right now I am launching my processes with the

NoMethodError in As1851Tests#new with shallow routes

。_饼干妹妹 提交于 2020-01-15 09:32:24
问题 I have a rails 5 app using shallow resource nesting. The form_for has stopped working and I can't find why. The App has multiple nested models that worked before changing to shallow routes on the recommendation from my previous question found here My Schema is as follows: db/schema.rb: create_table "as1851_tests", force: :cascade do |t| t.bigint "damper_id" t.boolean "AS1851A", default: false, null: false t.boolean "AS1851B", default: false, null: false t.boolean "AS1851C", default: false,

Group by month+year with counts

戏子无情 提交于 2020-01-14 13:28:07
问题 I have a table of Albums that has a date column named release_date . I want to get a list of all the month + year combinations present along with the number of albums released in that month/year. So, the output might be something like: November 2016 - 11 October 2016 - 4 July 2016 - 19 December 2015 - 2 Ruby 2.3.1 w/ Rails 5 on Postgres 9.6, FWIW. 回答1: I'm assuming your table is singular Album per Rails convention. If not, consider changing it. Album.all.map { |album| [Date::MONTHNAMES[album

HTTPS for Rails Application - InvalidAuthenticityToken

亡梦爱人 提交于 2020-01-14 12:57:27
问题 I am trying to get https to work for my rails application. When i try to do any post related activity on the application i am getting the following error. Exception `ActionController::InvalidAuthenticityToken' at /usr/local/rvm/gems/ruby-2.4.1/gems/actionpack-5.0.4/lib/action_controller/metal/request_forgery_protection.rb:195 - ActionCon troller::InvalidAuthenticityToken Exception `ActionController::InvalidAuthenticityToken' at /usr/local/rvm/gems/ruby-2.4.1/gems/actionpack-5.0.4/lib/action