railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.87k stars 2.25k forks source link

in enum.rb #3641

Closed sahil162001 closed 11 months ago

sahil162001 commented 11 months ago

in enum.rb file at line number 14 we can replace the map with collect

mshibuya commented 11 months ago

So what's good about that? Please provide a real use-case.

sahil162001 commented 11 months ago

So what's good about that? Please provide a real use-case.

By replacing the "map" with "collect" I think we can handle the collection of data, by using the collect . I also knew that map and collect are alias of each other but that is difference between map and collect.

mshibuya commented 11 months ago

Then please show me the difference by providing source code examples.

sahil162001 commented 11 months ago

Then please show me the difference by providing source code examples.

i am getting this type of error and debugging and on searching getting this The error you are getting is an ActionView::Template::Error. This error is raised when an error occurs while rendering a template. In your case, the error is being caused by the map method on the student object. The student object is a string, and strings do not have a map method.

To fix this error, you will need to change the code that is trying to call the map method on the student object. One way to do this would be to change the code to use the collect method instead of the map method. The collect method works on collections, and strings are considered to be collection

mshibuya commented 11 months ago

I don't understand what you're saying. As you said,

map and collect are alias of each other

so they are no different. If you still insist with your opinion, you need to show me a Ruby source code which shows #map and #collect behaving differently. Understood?

sahil162001 commented 11 months ago

but they have different way of working Sir, can we connect on LinkedIn

mshibuya commented 11 months ago

Sorry I'm not interested, thanks.