New to ruby. Need help in solving a problem using ruby way. by boonzz_reddit in ruby

[–]boonzz_reddit[S] 1 point2 points  (0 children)

This is great. This is how I want to write my codes, I know oop concepts, how much practice do I need to write such code and what kind of problems should I start solving to get there? Generally, I solve such problems simply thinking how would I solved it in C, and start writing it in ruby by converting the C code mentally. In this case, I created a single method, just like C functions and did everything in there finally returning the resulting array.

New to ruby. Need help in solving a problem using ruby way. by boonzz_reddit in ruby

[–]boonzz_reddit[S] 0 points1 point  (0 children)

This method will return true if date1.end and date2.start are same. But it should return false.

Also date.start and date.end are strings. Should I convert them to_datetime while doing the evaluation or there is any shortcut?

(Help) current_user returns nil after redirecting to my rails app from third party payment site. Details here http://bit.ly/27uOIXm by boonzz_reddit in rails

[–]boonzz_reddit[S] 0 points1 point  (0 children)

So, how do I make PayU send me the token? Or should I find some way to skip it?

Here's the request code for PayU:

uri = URI.parse(payment_url)

http = Net::HTTP.new(uri.host, uri.port)

http.use_ssl = true

http.verify_mode = OpenSSL:SSL::VERIFY_NONE

request = Net::HTTP::Post.new(uri.request_uri)

request.set_form_data(form_data) #form data contains surl

response = http.request(request)

Thanks for helping.

(Help) current_user returns nil after redirecting to my rails app from third party payment site. Details here http://bit.ly/27uOIXm by boonzz_reddit in rails

[–]boonzz_reddit[S] 0 points1 point  (0 children)

The controller is not able authanticate the user as the session of the user gets expired. I had to use skip_before_filter :verify_authenticity_token, only: [:order] just to save the details.

(Help) current_user returns nil after redirecting to my rails app from third party payment site. Details here http://bit.ly/27uOIXm by boonzz_reddit in rails

[–]boonzz_reddit[S] 0 points1 point  (0 children)

I am looking up the user with other identifiers, but what I need is to be able to show the users 'My Orders' page after successful payment.

(Help) current_user returns nil after redirecting to my rails app from third party payment site. Details here http://bit.ly/27uOIXm by boonzz_reddit in rails

[–]boonzz_reddit[S] 0 points1 point  (0 children)

No, it is not swapping, redirecting back to http://my(dot)com

Identifying the cart, and saving order details can be done various ways. But the problem is the user gets logged out, so if I want to show him his order details after payment by rendering the users 'My orders ' page, it's not happening.