Skip to content

Instantly share code, notes, and snippets.

View swapnilchincholkar's full-sized avatar

Swapnil Chincholkar swapnilchincholkar

  • Josh Software Pvt.Ltd.
  • Pune, Maharashtra, India
View GitHub Profile
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
hi:
devise:
confirmations:
confirmed: "आपका ईमेल पते की सफलतापूर्वक पुष्टि की गई है।"
send_instructions: "आपको कुछ ही मिनटों में अपने ईमेल पते की पुष्टि करने के लिए निर्देश के साथ एक ईमेल प्राप्त होगा।"
send_paranoid_instructions: "अगर आपका ईमेल पता हमारे डेटाबेस में मौजूद है, तो आप कैसे कुछ ही मिनटों में अपने ईमेल पते की पुष्टि करने के लिए निर्देश के साथ एक ईमेल प्राप्त होगा।"
failure:
already_authenticated: "आप साइन इन कर चुके हैं।"
require 'mongoid'
require 'minitest/autorun'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
Mongoid.configure.connect_to("mongoid_test")
class Band
include Mongoid::Document
belongs_to :studio
end
@swapnilchincholkar
swapnilchincholkar / assign_images_s3.rb
Created July 27, 2014 17:25
Ruby code to copy images from or within 3 bucket, without reprocessing
module AssignImagesS3
def assign_images(src_parent_obj, dest_parent_obj)
# 1. get parent image object
src_parent_obj.images.each do |src_img|
# 2. create new image object and save it without any attachment
dest_img = dest_parent_obj.images.create(is_processed: true)
# 3. While assigning src image attributes to dest obj,
# assign attribute 'uploading_via_copy' to true so
@swapnilchincholkar
swapnilchincholkar / user.rb
Last active December 28, 2015 15:49
Using default parameter while writing test cases.
class User
field :first_name, type: String
field :company_name, type: String
field :role, type: String
def name
role == 'admin' ? first_name : [company_name, first_name].join(':')
end
end
@swapnilchincholkar
swapnilchincholkar / _header.html.haml
Created November 12, 2013 08:13
Using 'render_views' while writing controller specs.
/ app/views/shared/_header.html.haml
= render 'users/links'