Save 36% for Black Friday! Learn more

New Discussion

Notifications

You’re not receiving notifications from this thread.

Improving the URL Shortener Design Discussion

3
General

Hello Chris and ROR developers, Why I need to add **kwargs and what is doing ??

def favicon_image_tag(domain, **kwargs)
image_tag google_favicon_url(domain), **kwargs
end

Hey Diego, the **kwargs parameter is added to the method signature so that you can pass a hash of options to the favicon_image_tag method which will then be forwarded along to the image_tag method. This allows you to be able to pass different options (kwargs) wherever you call the favicon_image_tag method to customize attributes of the image_tag method. Hope that helps!

Thanks for taking the time to answer my question. I appreciate it.

No problem! I hope that clears it up for you, Diego!

Join the discussion
Create an account Log in