Since the "file system" and the "rails" are such common themes, both together and separate, I cannot find any open source Ruby on Rails application that implements the file system in the database. I would like to use such an application as a starting point or template.
I have already been able to implement the User and Directory models (using Ancestry for the latter), and I find my path to the File model (my application needs only one kind of file).
class User < ActiveRecord::Base attr_accessible :email, :name, :password, :password_confirmation has_secure_password has_many :directories, dependent: :destroy # ... end # class User class Directory < ActiveRecord::Base attr_accessible :name, :parent_id has_ancestry belongs_to :user has_many :files, dependent: :destroy # ... end # class Directory # not actually implemented, yet class File < ActiveRecord::Base attr_accessible :name belongs_to :directory # ... end # class File
In views, I use jsTree to represent the tree and the form for adding / removing, editing, ... This will need to be changed to use AJAX , since redirecting back to the same page does not save the expanded / collapsed state of the tree.
However, I have this feeling when I do what has already been done many times. Can you provide links to such applications or give recommendations on the implementation of both part of the model and part of the presentation?
source share