[ruby] validates_format_of :url, :with => /\A(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w\.-]*)*\/?\Z/i [/ruby] Notice that I'm using "A" and "Z" because if you use ^ and $ you will see this warning security from Rails validators. [ruby] Valid ones: 'www.crowdint.com' 'crowdint.com' 'http://crowdint.com' 'http://www.crowdint.com' Invalid ones: 'http://www.crowdint. com' 'http://fake' 'http:fake' [/ruby] ...
I was struggling with the "UNEXPECTED_ERROR, An unexpected error occurred. Error ID" error received while using the Netsuite Webservice endpoints. The error looked something like so: [shell] <soapenv:Body> <addResponse xmlns="urn:messages_2014_2.platform.webservices.netsuite.com"> <writeResponse> <platformCore:status xmlns:platformCore="urn:core_2014_2.platform.webservices.netsuite.com"...
How to create a new nested attribute form for only new records in a has_many relationship using simple_form, well according to this stackoverflow http://stackoverflow.com/questions/14884704/how-to-get-rails-build-and-fields-for-to-create-only-a-new-record-and-not-includ I was trying to create a new records using nested attributes the problem with that solution it is that if the...
Find the commit where the things are working correctly: [shell]in my case: 5b2f156 or the whole commit 5b2f156e43e25f71df55bbd0bc887662c48937a59[/shell] Find the commit where the things are not working or are failing: [shell]in my case: 66b6b6be43e25f71df55bd0bc887662c49937a59[/shell] Lets find the root of the problem: [shell]git bisect start[/shell] specify the good commit [shell]git bisect good 5b2f156[/shell] Specify...
I just found great the way that the cancel subscription works(ruby pattern) in the braintree gem, that's why I'm sharing this pattern with you guys: Gem https://github.com/braintree/braintree_ruby [ruby] # Just execute this class method Braintree::Subscription.cancel(subscription2.id) [/ruby] Logic Behind the scenes [ruby] # lib/braintree/subscription.rb module Braintree class Subscription def self.cancel(subscription_id) ...
Sometimes you want to add a basic security layer for your privated website or application in Rails, for those cases you can do it actually pretty easy and you just need to provide a user and password credentials in order access the Website/Web Application. For example...
Well thank you very much to lucasroesler for his post at: https://coderwall.com/p/uqttoa/post-x-www-form-urlencoded-data-with-restangular, I tried to follow up the post because as he says "I had hard time to understand how I could send my data with Restangular", his solution it is really good but rails...
Export and import from local to heroku From local run the following command replacing with your own values [shell] pg_dump --no-owner --no-acl -d db/padroncolima_development > yourdatabasedump [/shell] Upload this file "yourdatabasedump" into a public repository like S3( if that is the case dont forget to set public permissions to the...