ruby tag

542 questions


2 answers
43 views
0
I want to add a conditional operator to the hash.

Currently, the code is as follows:current_page?(controller: 'foo', action: 'bar')This time, I would like to increase the action (even if it is a different action).However, it doesn't work even if I wr...

2 years ago

1 answers
39 views
0
class method errors:uninitialized constant

I'm a beginner. This is my first question.I'm sorry for the rudiments.The class method is defined by a unique class method, but even if you execute it with the code below, You will encounter the follo...

2 years ago

7 answers
44 views
0
I want to run a program created by ruby from the terminal with a command.

The environment is Mac and CentOS.To run a program called ~/hoge/ruby.rb from a terminal, it usually must be $ruby~/hoge/ruby.rb.Can I do this like $hoge-option?If possible, please let me know what st...

2 years ago

1 answers
66 views
0
Please tell me how to separate the content-type processing in grape.

I am creating an API using grape.(I don't use other frameworks such as ruby on rails or sinatora .grape alone.)Check the content-type of the http header in the request and determine if the value is ap...

2 years ago

3 answers
91 views
0
Ruby on Rails cannot generate StaticPages controllers.

I am developing Ruby on Rails on Macbook Air.I am studying Chapter 3 of the Ruby on Rails tutorial, but I am getting an error when I try to generate a StaticPages controller. rails generate controller...


2 answers
42 views
0
How to Obtain a Random Time for a Day Specified in ruby

How do I get a Time object with a random time by specifying only the date in ruby?For example, if you want a random date of 'June 22, 2016', June 22, 2016 19:44:34.

2 years ago

2 answers
38 views
0
I want to take out the values of the columns in the Rails Controller 1-to-Multiple relationship table and display the sum in View.

】What I want to realize したい①You want to retrieve the values of columns in tables that have a one-to-many relationship and that have a child relationship.②I want to add up what I took out and display i...

2 years ago

1 answers
43 views
0
Understanding URL Behavior After New Action Validation Errors and Accompanying Errors

This is my first time to ask a question.I have a long question, but I will chew it up as much as possible, so I would appreciate it if you could let me know the details.In my environment, when I post ...

2 years ago

4 answers
39 views
0
I want to put objects together beautifully with ruby.

[ { : id=>1, —data=>1 }, { : id=>1, —data=>2 }, { : id=>2, —data=>1 }, { : id=>2, —data=>2 }]↓I want to do this[ { : id=>1, —data=>[1,2] }, { : id=>2, —data=>[1,2] ...

2 years ago

1 answers
43 views
0
Data linked by has_many in Rails are duplicated.

When retrieving data related to the model defined by has_many+through, there was a case where each data was retrieved duplicately, although there was only one data in the database.For more information...

2 years ago
« - 15 - »

© 2024 OneMinuteCode. All rights reserved.