ruby-on-rails-5 Questions

3

Solved

I've found a wonderful ActionCable gem, which is a good solution for SPA. I want to send only the html, css and js assets, all other connections will be implemented through ActionCable. It's not d...
Premeditation asked 15/8, 2015 at 14:54

1

Solved

I have simple action show def show @field = Field.find_by(params[:id]) end and i want write spec for it require 'spec_helper' RSpec.describe FieldsController, type: :controller do let(:fi...
Moriahmoriarty asked 5/5, 2017 at 5:26

3

Solved

I've used this method for modals in rails. It works really well, but I've just upgraded to Rails 5 beta3, and now it's not working in production. I get this error: Completed 500 Internal Server E...
Stigmatize asked 5/4, 2016 at 18:43

1

Solved

I'm using Rails 5 to serve a website and a RESTful API, and I use Newrelic (newrelic_rpm gem) to monitor the application performance. At the moment, the gem monitor to all requests to one applica...

2

Solved

Say I have the following: link_to "Excel", params.merge(format: 'xlsx') Rails 5 says, Attempting to generate a URL from non-sanitized request parameters! An attacker can inject malicious data ...
Journal asked 25/8, 2016 at 18:59

2

Solved

I just tried to use Rails' time helper method travel in one of my feature specs: scenario 'published_at allows to set a publishing date in the future' do magazine_article.update_attribute(:publis...

1

From the Rails Guide I found following three code snippets ActionCable.server.broadcast("chat_#{params[:room]}", data) This simple broadcast sends the data to a specific chat room while ...
Bushel asked 23/1, 2017 at 12:51

1

Solved

I am trying to debug a problem with secrets.yml loading environment variables, by setting some environment variables in development and running rails c to inspect things. When I load Rails.applicat...

3

I've recently switched my rails project from Rails4 to 5.0.0.beta3 to use the awesome ActionCable. My ActionCable server is run inside unicorn. In development all works fine. In production I have ...
Skiing asked 28/3, 2016 at 9:25

4

Solved

According to the Rails Edge Guide all ActionDispatch::IntegrationTest HTTP requests take optional named keyword arguments: get post_url, params: { id: 12 }, session: { user_id: 5 } Great. Now, I'...
Frankfurter asked 13/6, 2016 at 17:49

2

I am trying to implement notification using the action cable in Rails 5. After reading the tutorial for the Action cable, which work on the session & Cookies based Authentication to receive th...
Therese asked 1/10, 2016 at 12:3

1

Using Rails 5, Ruby 2.4. If I have located a node using Nokogiri parsing, how would I find all the nodes that occur before my found node that do not also include that found node? That is, let's say...
Crystallo asked 4/4, 2017 at 22:4

2

Solved

So I have code in my application that appends to a has_many relation with the "<<" operator like so: class BlogPost < ActiveRecord::Base has_many :comments def add_comment(content) @...

1

Solved

I'm using Rails 5. I'm currenlty using Rails in-memory cache to cache db query results, for instance, this is in my state.rb model ... def self.cached_find_by_iso_and_country_id(iso, country_id) ...
Dyanne asked 12/4, 2017 at 16:50

1

Solved

I'm referring to the modules you create in app/helpers. Are they available in: Views? Controllers? Models? Tests? Other files? Sometimes? All the time?
Hotfoot asked 15/4, 2017 at 22:37

1

Solved

Rails 5.1 removes a whole load of previously deprecated methods. Among them is the old friend render :text. It was very useful when you need to render some text, but don't want the overhead of a v...
Choose asked 15/4, 2017 at 17:18

2

Solved

I'm using Rails 5 (Ruby 2.4). I have a block of code that catches an exception and prints out, what I thought was a stack trace ... begin ... rescue Exception => e errors.push(e) puts "#{e...

4

I am trying to run an app with rails 5.0.0beta3 and websockets. I have everything working locally on development but in production I getting this response in my browser's console: "WebSocket conne...
Perusse asked 13/3, 2016 at 19:16

1

Solved

I have been following Michael Hartl's Ruby on Rails tutorial book to try and add users to my application. Reading chapter 6, I have added what I believe to be the necessary fields for my user, spec...
Hypoacidity asked 9/4, 2017 at 2:16

1

Solved

In a "normal" ActionView I can find out the current controller with controller_name. Is there any equivalent way to find out the mailer class in a mailer view?
Barnabas asked 8/4, 2017 at 20:5

0

To give you an idea of what I'm working on: I have a section inside of my main app which I've namespaced inside a "portal" route (localhost:3000/portal). I have two Devise models, User and Client. ...
Belief asked 6/4, 2017 at 23:43

1

Solved

To run a single test in Rails, we normally do: rails test TEST=test/system/invitation_test.rb But that doesn't work with system tests. Neither do this work: rails test:system TEST=test/system/i...

1

Solved

I have a model User that has multiple referenced "profiles". A user can have several of those profiles, and each of those profiles should induce a specific layout in emails. Let's consider the prof...
Sinkhole asked 12/6, 2016 at 22:24

4

I'm on Rails 5 (Ruby 2.4). I want to read an .xls doc and I would like to get the data into CSV format, just as it appears in the Excel file. Someone recommended I use Roo, and so I have book = Ro...
Granulocyte asked 28/3, 2017 at 19:5

2

Solved

Puma times out my request when I'm using binding.pry. In my controller def new require 'pry' binding.pry end I then make a request that hits the controller and enter the pry session. After 60 ...
Uranography asked 6/12, 2016 at 15:25

© 2022 - 2024 — McMap. All rights reserved.