Monday, January 30, 2017
Sunday, January 29, 2017
Friday, January 27, 2017
How to display the selected date in the edit form in Rails?
Use the selected: option in date_select to specify what date must be displayed in the edit form.
<%= f.date_select :published_at, order: [:month, :day, :year], start_year: Date.current.year - 5, end_year: Date.current.year + 1, selected: @episode.published_at %>
If you don't use this, when you edit the record next time, you will inadvertently change the date when you change some other field.
<%= f.date_select :published_at, order: [:month, :day, :year], start_year: Date.current.year - 5, end_year: Date.current.year + 1, selected: @episode.published_at %>
If you don't use this, when you edit the record next time, you will inadvertently change the date when you change some other field.
Thursday, January 26, 2017
Friday, January 20, 2017
unable to obtain stable firefox connection in 60 seconds selenium webdriver
bundle update selenium-webdriver
The latest version of this gem has lot of problems. The solution was to downgrade the Firefox browser to 47.0.1. I found the workaround by reading the Capybara gem readme file. Yes, that's why they call me a genius.
The latest version of this gem has lot of problems. The solution was to downgrade the Firefox browser to 47.0.1. I found the workaround by reading the Capybara gem readme file. Yes, that's why they call me a genius.
Custom View Helpers in Rails 5
Learn how custom view helpers work in Rails 5. You will also learn how to read the Rails source code to create experiments that answers questions about how Rails works. We will use ack tool to search for exact matches in Rails source very fast.
Monday, January 16, 2017
Credit card declined : This customer has no attached payment source.
I was getting this error when using Stripe to subscribe a customer. Solution:
def allowed_params
params.permit(:plan_name, :email, :password, :stripeToken, :authenticity_token)
end
customer = Stripe::Customer.create(email: email, plan: plan_id, source: stripe_token)
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => false %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => false %>
Best thing to do is to fail early and loudly, this will prevent the invalid request being submitted to Stripe. You must have:
raise 'Missing stripe token. Cannot process payment.' if params[:stripeToken].blank?
def allowed_params
params.permit(:plan_name, :email, :password, :stripeToken, :authenticity_token)
end
customer = Stripe::Customer.create(email: email, plan: plan_id, source: stripe_token)
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => false %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => false %>
Best thing to do is to fail early and loudly, this will prevent the invalid request being submitted to Stripe. You must have:
raise 'Missing stripe token. Cannot process payment.' if params[:stripeToken].blank?
Sunday, January 15, 2017
Rails Screencasts
Checkout the Rails screencast Autocomplete in Rails 5 : https://rubyplus.com/episodes/51
It covers using typeahead.js.
Checkout the Rails screencast Auto Complete Association in Rails 5 : https://rubyplus.com/episodes/181
It covers using jQuery for autocomplete feature.
Checkout the Rails screencast Movie Review Rails 5 App : https://rubyplus.com/episodes/1
It covers using Twitter Bootstrap 4
Checkout the Rails screencast Movie Review Rails 5 App : https://rubyplus.com/episodes/1
It covers using Elasticsearch for full text search
Checkout the Rails screencast Movie Review Rails 5 App - Part 3 : https://rubyplus.com/episodes/11
This covers devise.
It covers using typeahead.js.
Checkout the Rails screencast Auto Complete Association in Rails 5 : https://rubyplus.com/episodes/181
It covers using jQuery for autocomplete feature.
Checkout the Rails screencast Movie Review Rails 5 App : https://rubyplus.com/episodes/1
It covers using Twitter Bootstrap 4
Checkout the Rails screencast Movie Review Rails 5 App : https://rubyplus.com/episodes/1
It covers using Elasticsearch for full text search
Checkout the Rails screencast Movie Review Rails 5 App - Part 3 : https://rubyplus.com/episodes/11
This covers devise.
Saturday, January 14, 2017
Simple Search Form in Rails 5
Learn how to use a simple search form to search the database for records that has the given string in one of the columns of a table. Watch the Rails screencast Episode #30
Thursday, January 12, 2017
Friday, January 06, 2017
Cropping Images using jQuery Crop Plugin in Rails 5
Checkout the latest Rails 5 screencast on Cropping Images using jQuery Crop Plugin in Rails 5.
Subscribe to:
Posts (Atom)