Open lymecca opened 10 years ago
Hi @lymecca,
We are looking for any possibility to achieve this, will get back to you soon
Same here.. it would be great if there is a way to have a user per event, and also a calender per user.
For example, teachers who each have a calendar. And then students who can have one or many events with different teachers
That is what I am looking for! Anyone has completed that yet?
Hello,
I did it using devise gem that handles user authentication. But your case looks a little different... You may try something like this:
mount FullcalendarEngine::Engine => "users/:user_id/fullcalendar_engine"
Adds a migration:
rails g migration AddUserToFullcalentarEngineEvents user:references
On your User's model add this:
has_many :events, class_name: "::FullcalendarEngine::Event", foreign_key: "user_id", dependent: :destroy
Then you can use "decorator pattern" to override your engine controller.
EDIT: To override the views you can take a look at this
NOTE: When overriding views, it is necessary to add a file lib/fulcalendar_engine.rb
containing the following lines:
module FullcalendarEngine
class Engine
end
end
I hope it helps :)
Felipe Gruoso, That is awesome, but i am not sure to understand about "mounting" thing. Where to add "mount FullCalendarEngine...." to which file?
In config/routes.rb. I have something like this:
mount FullcalendarEngine::Engine => "/calendar"
get '/calendar' => 'calendar#index'
So, add mount FullcalendarEngine::Engine => "users/:user_id/fullcalendar_engine" to this. Like
mount FullcalendarEngine::Engine => "/calendar" mount FullcalendarEngine::Engine => "users/:user_id/fullcalendar_engine" get '/calendar' => 'calendar#index'
Right?
I'm not sure how to handle this if you have several calendars in your app. Maybe the developers of this gem needs to answer that question?
yeah. :(
Tried to do what you asked.
Added the mount of full calendar engine, but not calendar since we can't have two mount paths.
Tested localhost:3000/users/10/fullcalendar_engine. And can't save any event at all. :(
First I have to say my English is poor so apologize if I didn't make myself clear.
I think that it's a great gem! I wan't use it but I need some help about relationship. How can I configure that for events belongs_to user? Is it possible to do something like this...
mount FullcalendarEngine::Engine => "users/user_id/fullcalendar_engine"
and configure model and controller with this relationship?