10

Watched 10 videos

Watched 10 Videos from start to finish
6/10

Spread the word 1 time

Referred 1 Member to Drifting Ruby

500

500 times Chatter Box

Make 500 comments to videos or replies to other comments
319/500

4

Suggested 4 episodes

Helped the community by suggesting 4 episodes
3/4

128

Vote Suggestion 128 times

Helped the community by voting on suggestions 128 times
64/128

Watched 1 video

Watched 1 Video from start to finish

Earned on 3/4/2019

Subscribed for 1 month

Learning and showing your support for 1 Month

Earned on 3/4/2019

3

Subscribed for 3 months

Learning and showing your support for 3 Months

Earned on 3/4/2019

6

Subscribed for 6 months

Learning and showing your support for 6 Months

Earned on 3/4/2019

12

Subscribed for 12 months

Learning and showing your support for 12 Months

Earned on 3/4/2019

18

Subscribed for 18 months

Learning and showing your support for 18 Months

Earned on 3/4/2019

24

Subscribed for 24 months

Learning and showing your support for 24 Months

Earned on 7/6/2019

1 time Chatter Box

Make 1 comment to videos or replies to other comments

Earned on 3/4/2019

10

10 times Chatter Box

Make 10 comments to videos or replies to other comments

Earned on 3/4/2019

50

50 times Chatter Box

Make 50 comments to videos or replies to other comments

Earned on 3/4/2019

kobaltz PRO said over 3 years ago on Rails API - Authentication with JWT :

The reason why it is displaying the page instead of a JSON response is due to the sample application's routes.

  namespace :api, path: '/', constraints: { subdomain: 'api' } do
    resources :users
  end
  constraints subdomain: ['', 'www'] do
    resources :users do 
      resources :phones
    end
    root 'users#index'
  end

In the example application's routes, there is a constraints on the subdomain where if it is empty, it will default to the web view of the application. If you're using an API only, you can remove the constraints block as well as the constraints on the subdomain: 'api'. So your routes may look something like

Rails.application.routes.draw do
  post 'user_token' => 'user_token#create'
  devise_for :users
  namespace :api, path: '/' do
    resources :users do 
      resources :phones
    end
  end
end


kobaltz PRO said over 3 years ago on FullCalendar Events and Scheduling :

You have a few options on how to handle something like this. You could handle it on the server side with a model scope to check each individual day. However, that could be more taxing on the server if a calendar had several events; not to mention that you're calling the scope about 30 times per calendar view. An alternative would be to leverage client side calculations for the number of events. However, you could still run into issues with the client side taking a while to calculate the number of events.

Would your case use be for a smaller summary calendar? I know that the current version of FullCalendar does have a scaling feature where it will gracefully hide events and display a number of events for that day.



kobaltz PRO said over 3 years ago on FullCalendar Events and Scheduling :

Gotcha. It does make sense.

In that case, I would send an additional parameter with the JSON response of whether or not a day is blocked (which is calculated on the server side).

You can use the dayRender callback to change the color of a particular day based on the blocked days. Depending on how you are allowing new event creations, you would want to handle the validation there as well as the backend on the model.

This does get a bit tricky since you're having to validate on server side and render on client side as well.

Also check out this JSFiddle where they're adding a class to a date, dynamically, after the calendar is rendered.


kobaltz PRO said over 3 years ago on FullCalendar Events and Scheduling :

Yeah, I'd calculate it on the server side and then pass the blocked days through the JSON render request. On the client side, put in the results of the client side validation. Overall, you just want to make sure that you're aren't allowing a client to go through a whole event record creation, only to tell them something that you already knew and could have told them from the beginning; that enrollment for that day is already filled.


kobaltz PRO said over 3 years ago on FullCalendar Events and Scheduling :

You could do something like this

class LeaveEvent < ActiveRecord::Base
  scope :events_on_date, -> (date)  { where('start_time <= ? AND end_time >= ?', date, date).size }
 ...
end

Then use the scope within the JSON builder.