Questions tagged [ruby-on-rails-3]

Ruby on Rails is an open-source web development framework written in Ruby. Ruby on Rails follows the principle of convention over configuration, freeing you from having to re-invent things to stay productive. Use this tag only for Rails 3-specific questions, and also tag those questions [ruby-on-rails].

Filter by
Sorted by
Tagged with
0 votes
0 answers
6 views

How to pass header X-Request-Start to Rails app under Apache + Passenger

I need to pass header X-Request-Start to my Rails application. I add the header to the request using following directive in Apache configuration file: <VirtualHost *:443> ... RequestHeader ...
-2 votes
0 answers
20 views

what are the other different ways of using custom Time zone select option in Action view - ROR [closed]

I tried using time_zone_select of ActionView to display the list of zones for selecting GMT+08:00 'countryName' but this approach did not help in achieving. I tired out different ways to achieve the ...
  • 33
0 votes
0 answers
29 views

Not able to run Rails in Mac Apple Chip

I have rails installed in my Macbook. But is not getting detected. Check following commands. ~/W/exp $ ruby -v ruby 3.2.1 (2023-02-08 revision 31819e82c8) [arm64-darwin22] ~/W/exp $ rails -v Rails is ...
0 votes
0 answers
38 views

Error in Testing the User Controller: User count did not change by 1 and Expected response to be a redirect

These are the errors it shows, however, it does work on the system: UsersControllerTest#test_should_destroy_user [/mnt/c/code/toy_application/test/controllers/users_controller_test.rb:42]: "User....
  • 1,533
-1 votes
0 answers
24 views

remove_possible_method not removing the method for a module

My_module.methods returns: [:local_constants, :module_exec, :class_exec, :module_eval, :class_eval, :included_modules, :include?, :name, :ancestors, :instance_methods, :public_instance_methods, :...
0 votes
1 answer
39 views

Accessing a Profile in Ruby on Rails

I am trying to have the user (who is not signed in) be directed to the sign in page after clicking on "Your Profile" class ProfileController < ApplicationController before_action :...
1 vote
0 answers
23 views

Exception Handling in Rails Fragment Caching

I was trying to handle the exception if the Memcachier server is down, but it seems that is not happening. I am using a code snippet in the Rails view; basically, there is a service that would return ...
  • 621
0 votes
1 answer
54 views

NoMethodError: undefined method `pluck' for nil:NilClass [closed]

I am currently working with Ruby on Rails and I encountered a weird thing. So, I am creating an array, then using .pluck(:client_id) on that array and I get the following error: NoMethodError: ...
-2 votes
1 answer
56 views

Trying to connect Ruby on Rails with PostgresSQL

Everytime, I tried to create a user. This is what it shows: sudo -u postgres createuser jenn -s $ psql --version Warning: No existing cluster is suitable as a default target. Please see man ...
  • 1,533
0 votes
0 answers
13 views

Trying to remove the ID, timestamps and other information below the titles

enter image description here I only want the titles of the book and not the text below it. I tried looking if I am displaying anything other than the title but I can't seem to find it. This is my ...
  • 1
0 votes
0 answers
55 views

Ruby on Rails validation bypass and confusion

I am facing a strange thing on Ruby on Rails and I don't know what is the correct way to deal with this situation. I have two models, Book and Page. Book(name:string) Page(page_number: integer, ...
0 votes
1 answer
40 views

"rails db:migrate" error : relation "users" does not exist?

I am newbie with rails and here is my problem. I created a very simple rails program and in the db > migrate > 2023.._add_columns_to_user.rb file, I added this code to this file class ...
1 vote
2 answers
46 views

Rails not displaying error messages when submitting a form

I'm new to rails so I have a Signup controller that looks as follows: class SignupController < ApplicationController def new @user = User.new end def create @user = User.new(...
  • 7,133
0 votes
1 answer
32 views

Send attachment file in outgoing mail body in rails

I am trying to send S3 url file in mail body, but I am getting error Errno::ENOENT: No such file or directory @ rb_sysopen I want something like this, but I am unable to achieve this one @path = ...
  • 375
0 votes
1 answer
20 views

Rails admin gem, polymorphic association

How to get the queried data having polymorphic association I have an 3 models class Picture < ApplicationRecord belongs_to :imageable, polymorphic: true end class Employee < ApplicationRecord ...
0 votes
0 answers
23 views

Rails/Ruby dry-monads error on simple api call

I am testing out Shftcos APi boilerplate, which has a ton of additions including the dry-monads gem which Ive not encountered before. On a service call to fetch FakeStoreApi products am getting error ...
-1 votes
2 answers
66 views

How to make a text bold in helper.rb ruby file inside a string

i have one mailer file called schedule_mailer.html.erb in that I'm trying to use a helper method from that I'm rendering the contents in scheudle_mailer.html.erb <p style='font-size:15px;margin:0 ...
  • 51
0 votes
1 answer
27 views

How to access browser localstorage and get a specific item from localstorage using ruby on rails?

How to access specific item from localstorage, cookies using ruby on rails? I tried using localstorage.setItem and localstorage.getItem . but they are not providing proper o/p
  • 21
0 votes
1 answer
41 views

bulma html does not display as expect even though the code is entered properly

I am newbie with Rails and here is my problem I created a rails program by this command rails new freelancer -d=postgresql --javascript=webpack And I had no problem I wanted to use bulma extension in ...
0 votes
1 answer
34 views

rails did not auto add "jquery" to the package.json and yarn.lock files even though codes have been added to needed files?

I created a very simple Rails program named freelancer and want to use Bulma library and Jquery in this program. So here is what I did. In the file "Gemfile", I add this lines gem ‘bulma-...
0 votes
0 answers
199 views

Ruby pg-1.4.4 Segmentation fault at 0x0000000000000000

I see Segmentation fault at 0x0000000000000000 error when I try to connect to postgresql. I use ruby 2.7.7, Ubuntu 22.04.1 LTS, rails (5.2.6.2) What is the reason? /home/vital/.rvm/gems/ruby-2.7.7/...
  • 1
1 vote
2 answers
34 views

error when create a new folder by rails command : "can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException)"?

I am newbie with Rails and here is my problem. I created a new Rails's folder by this command rails new freelancer --database=postgresql --javascript=webpack And it gave me this error : can't find gem ...
0 votes
1 answer
22 views

Ruby on Raile menu page caching

I am creating applications where the menu structure is kept in a SQL database. Each user has a different menu depending on their permissions. The menu items as well as the permissions to them change ...
  • 237
1 vote
3 answers
55 views

Search users based on multiple elements

I am trying to impliment search functionality for user records with first_name, last_name, email, project_name,feature_name. Here first_name, last_name and email is from one table(User), project_name ...
  • 169
0 votes
0 answers
83 views

Caused by: Psych::BadAlias: Unknown alias: default

I see to have a very similar issue to this post visit_Psych_Nodes_Alias: Unknown alias: default (Psych::BadAlias) (if not exactly the same) rake aborted! Psych::BadAlias: Cannot load database ...
  • 8,341
0 votes
3 answers
46 views

Convert date string to Date where Day is missing

I know i can use to_date or parse to convert a string to a date in rails, but how do i convert to a date if the string is of the format "01-2018", where 01 is the month (January) and the day ...
  • 46.1k
0 votes
0 answers
59 views

Ruby run project while error how can ı solve this problem

Hi ı wanna run ruby project.I write rails server -e development but ı get an error /home/deployer/apps/isg/20220314091757/vendor/bundle/ruby/2.5.0/gems/activesupport-3.2.9/lib/active_support/values/...
0 votes
0 answers
33 views

SOLVED Handle multiple AMQP Pattern inside one Rails Service using Bunny gem

SOLVED PROBLEM. Just create 2 different queues, like rpc.queue and pubsub.queue. Then you can use multiple messaging pattern in one service without any problem. I create one rails service using Bunny ...
0 votes
0 answers
13 views

ActiveRecord::StatementInvalid in Summaries#index

PG::UndefinedColumn: ERROR: column summaries.user does not exist LINE 1: SELECT "summaries".* FROM "summaries" WHERE "summaries"."use... I'm trying to make a view ...
0 votes
0 answers
18 views

covering edge cases of dates in Ruby

I have one usecase, where I am doing manipulation based on dates. However there are some edgecases which is causing trouble in my logic and I am not able to figure out a way to cover those edge-cases. ...
0 votes
1 answer
20 views

string operation in ruby

I have a below string array object which has 4 elements. I want to compare the elements of this list to an string and want to check if string is part of this list. list = ["starter_v2", &...
1 vote
1 answer
68 views

Redirect to another controller's action with form validation error in Rails

I have parent and child, child form is in parent page so I can make children. I want to redirect or render parent controller's show page in child's controller. My controller is : @child = Child.new(...
  • 27
0 votes
1 answer
30 views

Can i use variables in Rails link_to method?

Can i use variable for Rails link_to helper for making different link with variables? For example, <%= link_to users, users_path %> I have link like this, And i'd like to change this url with ...
0 votes
2 answers
164 views

omniauth: (linkedin) Authentication failure! invalid_credentials

Request phase initiated. Started GET "/users/auth/linkedin/callback?code=...&state=..." for 127.0.0.1 at 2022-09-14 20:50:20 +0200 D, [2022-09-14T20:50:20.537126 #37240] DEBUG -- ...
-1 votes
1 answer
60 views

compare different objects of array with same value in ruby

I have a usecase, where I have two different array of object which consist of same attributes with different/same values. Ex: x = [#<User _id: 32864efe, question: "comments", answer: &...
0 votes
2 answers
41 views

Convert array of objects as string into array of hashes?

from this ["{\r\n \"charge_type\": \"sports\",\r\n \"amount\": 1000\r\n},{\r\n \"charge_type\": \"servicing\",\r\n \"amount\": 550\...
1 vote
1 answer
63 views

Is there a python difflib.get_close_matches("targetString", array) equivalent in Ruby?

Is there a method in Ruby similar to Python's difflib.get_close_matches("<target_string>", "[<array_of_strings>]") method?
  • 281
0 votes
0 answers
74 views

Facing errors in running the application of Ruby on Rails

Im new to ruby and when try run a application, Im facing the below error Gemfile: source 'https://rubygems.org' gem 'rails' gem 'mysql2' gem 'sass-rails' gem 'uglifier' gem 'coffee-rails' gem 'jquery-...
0 votes
0 answers
132 views

Error: Missing target element || Stimulus 1.1.1 Rails 6

I have this error 'Error: Missing target element' in console when i try to select one target. The main idea here is to iterate through an array of web_servers and select for each controllers, a target ...
  • 15
0 votes
1 answer
46 views

Ruby on Rails Enum fetch

I have a enum and two Constant enum status: { draft: 0, published: 1 } I_CODE = 23 J_CODE = 24 I have a method in that I have to check status is draft then in database I have to save value 23 ...
0 votes
0 answers
26 views

Using ActiveRecord to query count() over()

I want to limit the SQL query result set while also knowing how many possible rows match. I found that (with Postgresql), I could write SELECT *,count(*) over() as total FROM ... WHERE ... LIMIT 5 ...
  • 2,127
0 votes
0 answers
42 views

(Rails)Where should i define method that can use in Rspec and Controller?

I'm making method that can used in Rspec test and Controllers. But i don't know where to store it. Here are options that i have thought. application_helper -> but this file is used for method ...
0 votes
0 answers
95 views

Tests in circleci wont pass after upgrading ruby and heroku to 20 from 18

I am currently working on an app that uses ruby on rails on the backend and react.js on the front end. Since Heroku 18 is ending, I decided to start the upgrade to Heroku 20 which will be available ...
1 vote
0 answers
42 views

Always showed Intent to receive required on Xero Webhooks and not x-xero-signature header not matched

When a click on Intent to Receive then it always showed me same like Intent to Received required, not showed 200 OK. Method for ensuring_security is: def ensuring_security? key = '...
0 votes
0 answers
53 views

Rails Model Custom Validation Won't Work On Update

I try to create some model validation on my Coupon Model evrything work on create, but when i try to update data the validation won't validate the first validation is to raise error if percentage more ...
4 votes
3 answers
1k views

How to install ruby 3.1.2 in an Ubuntu Docker container?

I tried: if ! command -v ruby &> /dev/null then # - proverbot's version # First, install Ruby, as that is for some reason required to build # the "system" project # git ...
0 votes
0 answers
54 views

ActionController::RoutingError (No route matches "/welcome/admin_dashboard"):

I am trying to setup VirtualX Assessment Software that I downloaded online. Here is the link where I got it: https://virtualx.sourceforge.net/download.html I managed to make it run where I was able to ...
0 votes
1 answer
368 views

Error while trying to install mysql in Ruby on rails

Ruby version - ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x64-mingw-ucrt] Rails Version - Rails 7.0.4 Command = gem install mysql2 I have already install mysql community version and placed ...
  • 9,638
0 votes
1 answer
38 views

Access value from a Netsuite hash, Enumerator

Hi I am trying to extract a value from a Netsuite hash inside custom fields, and some others, which typically look like this - ` "custbody_delivery_ticket_number"=> { "script_id&...
0 votes
0 answers
38 views

how to add extra value to query in ruby

hello i have query to fill list box with this query how i can add an static value to select all clients tipo = $evm.root['dialog_param_type'] option = $evm.root['dialog_param_action'] dialog_field = $...

1
2 3 4 5
1123