ruby-on-rails

Check element visibility that is visible for less than a second in Rails Capybara

大城市里の小女人 提交于 2021-02-19 08:01:26
问题 I am trying to write an integration test in which I must check the visibility of an element on button click. The code works perfectly in one machine and failing in the other. The element is displayed until the data comes from the backend. So its visibility depends on the speed of the machine also. Is that the problem? This is the code: assert page.has_css?('#my_element_id') assert find('#my_element_id', visible: true) But I am getting an error: expected false to be truthy . Is there any other

getting this net::ERR_EMPTY_RESPONSE error in browser

烈酒焚心 提交于 2021-02-19 07:36:45
问题 I used gem "paperclip" for upload images and gem "paperclip-storage-ftp" for store images on my own ftp server.I got success to upload multiple photos and it's saved in my database too without having error. but when I go to show photos page there i can see some photos proper, But some most of photos are broken, and i am getting so many error in browser console like this Failed to load resource: net::ERR_EMPTY_RESPONSE help me if you have any solution for this. Thank you. 回答1: Process Your

Rails 4 mailers with gmail smtp

喜你入骨 提交于 2021-02-19 07:31:12
问题 I want to use the Mailer of Rails 4 with the Gmail's smtp configuration In my development file i set: config.action_mailer.perform_deliveries = true config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :domain => "gmail.com", :user_name => "mymail@gmail.com", :password => "mygmailpassword", :authentication => :plain, :enable_starttls_auto => true } but i don't recive any mails. This is the output of the terminal: To:

RoR Filter Out Current User with Join, Select and Order

て烟熏妆下的殇ゞ 提交于 2021-02-19 07:31:10
问题 I have the following statement in an RoR controller called nominations: @users = User.joins(:department).select("CONCAT(last_name, ', ', first_name, ' - ', name) as user_dept, last_name, first_name, name, users.id").order("last_name, first_name, middle_name") In the view, I have this to put this in a drop down: <%= select_tag "nomination[user_id]", options_from_collection_for_select(@users, :id, :user_dept), prompt: "Select User" %> I want to filter out the current user so that someone can't

Why rbenv does not work on Mac OS Catalina

余生颓废 提交于 2021-02-19 07:14:40
问题 I'm trying to run a Ruby on Rails project which has the version 2.4.1 and my system is 2.6.x . What I did was install via Rbenv the old version of Ruby then I did the following commands: rbenv global 2.4.1 -> to change global Ruby version ruby -v ruby 2.6.5p114 rbenv global 2.4.1 So there is something wrong as I would like to use 2.4.1 but seems not working that. I'm unable to start the bundle as it is saying I don't have 2.4.1 installed. I need a solution to Mac OS Catalina as I did as I

Why rbenv does not work on Mac OS Catalina

牧云@^-^@ 提交于 2021-02-19 07:14:37
问题 I'm trying to run a Ruby on Rails project which has the version 2.4.1 and my system is 2.6.x . What I did was install via Rbenv the old version of Ruby then I did the following commands: rbenv global 2.4.1 -> to change global Ruby version ruby -v ruby 2.6.5p114 rbenv global 2.4.1 So there is something wrong as I would like to use 2.4.1 but seems not working that. I'm unable to start the bundle as it is saying I don't have 2.4.1 installed. I need a solution to Mac OS Catalina as I did as I

Why rbenv does not work on Mac OS Catalina

不羁岁月 提交于 2021-02-19 07:14:25
问题 I'm trying to run a Ruby on Rails project which has the version 2.4.1 and my system is 2.6.x . What I did was install via Rbenv the old version of Ruby then I did the following commands: rbenv global 2.4.1 -> to change global Ruby version ruby -v ruby 2.6.5p114 rbenv global 2.4.1 So there is something wrong as I would like to use 2.4.1 but seems not working that. I'm unable to start the bundle as it is saying I don't have 2.4.1 installed. I need a solution to Mac OS Catalina as I did as I

How can I remove https and http from ruby on rails

旧城冷巷雨未停 提交于 2021-02-19 06:49:04
问题 I need to remove the "https" and the "http" from a url from my form in order to show the image later, I got the form where i'm including title and url like this: Form: <%= form_for( @article, :html => { class: "form-test", role: "form"}) do |f| %> <%= f.label :Titulo %> <%= f.text_field :title%> <%= f.label :Imagen%> <%= f.text_field :img%> <%= f.submit "Post"%> <% end %> View: <div class="header"> <%= image_tag("https://#{@article.img}") %> <%= @article.title%> </div> I'am looking for option

Use Storext (or just Virtus) with nested array or hash objects

流过昼夜 提交于 2021-02-19 05:32:18
问题 I have a postgres DB backing my Rails app with a class with a jsonb column class Product < AR::B include Storext.model(data: {}) store_attributes :data do thing_one String thing_two Boolean # Not actually showing up in the `data` hash foos FooCollection[Foo] end end class FooCollection < Array def <<(obj) if Hash super(Coupon.new(obj) else # Other coersions end end end class Foo include Storext.model attribute :id, Integer attribute :price, Float attribute :regular_price, Float end But Foo in

Rails Jquery compute total from selected checkboxes in a table

假如想象 提交于 2021-02-19 05:30:26
问题 So here is my rails view which has a form which pulls the product_items and lets the user check all the items they want to buy and display the total order amount underneath the table. (attached pic) My code looks like below. The server side is good (where I can save the order) but I need some help on the client side js to compute the order total and displaying the order total underneath the table. <tbody> <% @cause.product.product_items.each do |item| %> <tr> <td width="60%"><label class=