Answers
Courses
Tests
Examples
Sign Up
Sign in
What do you want to save?
Add Code snippet
New code examples in category Ruby
Awgiedawgie
2022-05-14 00:25:03
ruby get min value from array
people = {'joe' => 21, 'bill' => 35, 'sally' => 24} people.min_by { |name, age| age } #=> ["joe", 21] people.max_by { |name, age| age } #=> ["bill", 35]
Add solution
Lionel Aguero
2022-05-13 17:30:44
rails link_to class
<%= link_to "Get More Books", books_path, class: "index-link" %>
Add solution
Awgiedawgie
2022-05-13 17:26:15
rails server not updating
#config.file_watcher = ActiveSupport::EventedFileUpdateChecker config.file_watcher = ActiveSupport::FileUpdateChecker
Add solution
Awgiedawgie
2022-05-13 15:46:01
rails image
<%= image_tag 'icon.png', alt: 'icon' %> # => <img src='app/assets/images/icon.png' alt='icon' />
Add solution
Awgiedawgie
2022-03-27 15:25:03
ruby assign value to hash
my_hash = Hash.new #=> { } # OR my_hash = {}
Add solution
Awgiedawgie
2022-03-25 05:05:10
test if array empty ruby
irb(main):001:0> [].length => 0 irb(main):002:0> [1].length => 1 irb(main):003:0> [1, 'foo'].length => 2
Add solution
Awgiedawgie
2022-03-24 20:45:17
rails update without validation
# no validations user.update_attribute(:last_request_at, Time.current) # no validations AND callback user.update_columns(last_request_at: Time.current)
Add solution
Krish
2022-03-23 06:15:08
ruby hello world
# Hello World Program in Ruby! puts "Hello, World!"
Add solution
Awgiedawgie
2022-03-23 03:40:01
rails keep all params except for some
params.require(:shoes).except!(:shoes_id).permit!
Add solution
Awgiedawgie
2022-03-20 07:15:08
rails hidden field default value
hidden_field(:object, :field, :value => params[:requestval])
Add solution
‹
1
2
3
4
5
6
7
8
9
10
...
38
39
›
Best helpers
daily
weekly
monthly
for 3 months
Ranking is empty
This website uses cookies to make IQCode work for you. By using this site, you agree to our
cookie policy
Pleased to see you again
Sign up to unlock all of IQCode features:
Master useful skills
Improve learning outcomes
Share your knowledge
Sign in
E-mail
Password
Recover lost password
Log in
Or log in with
Not registered?
Sign up takes less than a minute
Create a Free Account
Sign up to unlock all of IQCode features:
Master useful skills
Improve learning outcomes
Share your knowledge
Sign up
Email
Password
Sign up for free
Or sign up with
By signing up, you agree to the
Terms and Conditions
and
Privacy Policy
. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.