Questions tagged [ruby-on-rails-5.2]

For issues specific to the version 5.2 of Rails. If your question applies to Ruby on Rails in general, use the tag [ruby-on-rails].

Ruby on Rails 5.2, "an open-source web framework that's optimized for programmer happiness and sustainable productivity." Rails 5.2 brings a bunch of new features and improvements over older Rails versions.

Major Features

  • Active Storage
  • Redis Cache Store
  • HTTP/2 Early Hints
  • Credentials

See Ruby on Rails 5.2 Release Notes for more information.

Resources

Related tags

540 questions
0
votes
2 answers

How to redirects from one page to another in ruby on rails

I am using ruby on rails devise. I made a login_controller. class LoginController < ApplicationController def homepage end end Action page
<%= button_to "Sign Up", root_url, :method => :get, :form_class => "link"…
Pushpam Kumar
  • 132
  • 1
  • 11
-1
votes
1 answer

Rails5.2 - Active Record .select() causing error when .count is called

How do I add another column to scope and still be able to call .count, .find, .where, etc. User.all.select('users.*,"one" as one').count Result: (1.3ms) SELECT COUNT(users.*,"one" as one) FROM "users" Traceback (most recent call last): …
user2012677
  • 5,465
  • 6
  • 51
  • 113
-1
votes
1 answer

PG::DuplicateColumn: ERROR: column "product_id" of relation "users" already exists

I have seen this question posted several times and the solution is always to drop the database and recreate it. I have data in my database and hence do not want to do that. Schema: create_table "users", force: :cascade do |t| t.string "email",…
user2012677
  • 5,465
  • 6
  • 51
  • 113
-1
votes
1 answer

Form_form vs Simple_form (Collections: value_method, label_method)

In simple_form, you can do use label_method and value_method, like the below.. f.association :company, collection: Company.all.order(:name), label_method: :name, value_method: :value 1) Does form_for have the same methods? 2) What are the default…
user2012677
  • 5,465
  • 6
  • 51
  • 113
-1
votes
1 answer

Statement invalid while rendering json in Rails

for my snippet below for rendering the json def show @product = Product.find(params[:id]) render json: @product.to_json(:include => { :items => { :only => [:id, :description] }}) end While rendering the json for has many attributes model…
-1
votes
3 answers

How to display data using a namespaced controller rails 5.2

I have an admin namespace with items as a resource in it: namespace :admin do resources :items end My items controller located in app/controllers/admin/ looks like this: module Admin class ItemsController < ApplicationController def show …
Justice M
  • 1
  • 2
-1
votes
1 answer

html_safe not working in controller rails 5

I currently need to send static content using API's created from admin using CKeditor. Now when rendering the html contents in tags are not appering even after using raw and html_safe, escape_html etc render json: {responseCode: xxx,…
-1
votes
1 answer

Saving a record with Has_Many_Through records in Rails 5.2

I'm getting "spans invalid" error when saving a job record that: #job.rb class Job < ApplicationRecord has_many :workspans has_many :spans, through: :workspans end I didn't get this error in rails 5.0, but on upgrading, I can't associate…
Will
  • 4,498
  • 2
  • 38
  • 65
-1
votes
4 answers

Can't start Rails localhost - (no processes running on port 3000)

tried to start my rails server, but I got that error => Booting Puma => Rails 5.1.4 application starting in development => Run `rails server -h` for more startup options [25156] Puma starting in cluster mode... [25156] * Version 3.9.1 (ruby…
ELTA
  • 1,474
  • 2
  • 12
  • 25
-2
votes
1 answer

Rails 5.2: secure form_for to prevent user to alter form select_tag / hidden_field values

In my form I'm using authenticity_token: true and I'm wondering if this is enough to prevent current_user to alter given options for my select_tag? Same question applies for using hidden_field in my form. In my case there is a form, where…
matiss
  • 747
  • 15
  • 36
-2
votes
1 answer

How to remove bookmarks when using wicked_pdf gem in Ruby on Rails?

I am using Ruby 2.5.3p105 and Rails 5.2.0 . And gem 'wicked_pdf' 1.1.0 for pdf download. From below picture, on hover I am getting bar in the top which include several things like title, page no, rotate, download, print, and last one is bookmarks.…
Priyank Dey
  • 1,104
  • 1
  • 19
  • 43
-2
votes
1 answer

How to model common information for Rails application

I'm a bit new in rails development I'm modeling a website with few resources and so far so good. But here is my question: I would like to allow the admin users to manage information show in most of the pages: Application name, telephone number,…
HatsuMora
  • 194
  • 1
  • 8
-2
votes
1 answer

ActiveRecord 5.2.0.rc1 & Representable Error

I updated the application and received an error with Representable: activerecord-5.2.0.rc1/lib/active_record/coders/yaml_column.rb:24:in load': undefined methodnew' for Representable::JSON:Module (NoMethodError) Can anybody help me with it?
-3
votes
1 answer

no implicit conversion of String into Integer error in ruby on rails

I want access each of 1_1 1_2 1_3 from my rails views , Now how i can define each of this in my Odd class to access them ? I get this error no implicit conversion of String into Integer on this line Odd.new(args.fetch("1_1", {})) Json responce :…
Qasem
  • 9
  • 1
  • 7
-5
votes
1 answer

Get “wrong number of arguments” on ruby on rails

wrong number of arguments (given 2, expected 1) SportsController class SportsController < ApplicationController def index @sport = Sport.all @events, @errors = Bapi::Inplay.all(query) end private def query params[:query,…
Qasem
  • 9
  • 1
  • 7
1 2 3
35
36