This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# before filter for api controller | |
def verify_authenticity_token | |
@current_user = User.find_by_authentication_token(params[:auth_token]) | |
render status: 401, json: { message: '...' } and return unless @current_user | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in your view (HAML + simple_form, simplified for easier reading) | |
= simple_form_for @bp_reading do |f| | |
= f.input :recorded_at, :as => :string, :input_html => { :class => 'jquery-ui-date', :value => @bp_reading.try(:recorded_at).try(:strftime,'%m/%d/%Y')} | |
= f.input :recorded_at, :as => :hidden, :input_html => { :id => 'recorded-at-alt'} | |
= f.button :submit, :disable_with => "Saving...", :value => "Save" | |
# in your javascript (coffeescript) | |
$ -> | |
$(".jquery-ui-date").datepicker( | |
altField: "#recorded-at-alt", |