pfletcherhill / Gandalf

Events application for the Yale community.
2 stars 0 forks source link

Importing, seeding events, organizations, categories, locations #56

Closed pfletcherhill closed 11 years ago

pfletcherhill commented 11 years ago

There's nothing too complicated in this PR, although high-fives for negative lines!

ヘ( ^o^)ノ\(^_^ )

Anyway, we now have an admin panel and can import datasets of student organizations, leaders, and categories into the database through it. Admins are defined by having self.admin = true, and you can promote or demote users with user.promote and user.demote respectively -- very simple.

I initially was working on making the seeding tasks (importing organizations and leaders, for instance) a background job. However, it doesn't take long enough to justify starting a worker and we don't want to have to start seed jobs through the console. This way, any admin can do all that through the app.

rake db:seed is now much simpler, utilizing the tasks that import data from csv's and the Yale Events Calendar. We can add random subscriptions and other niceties, but it just seems nicer to do it this way, and we get more representative, comprehensive data.

khannotations commented 11 years ago

Nice! This looks great. I added .csv to the gitignore because i thought it would clutter things up...wanna remove that line from the .gitignore and repush? then i'll have the csv.

pfletcherhill commented 11 years ago

I'll just send you the CSV via email. The idea with rake db:seed is that in development it generates everything from the in-app data /lib/data/....csv. But in production it prompts you to upload a dataset, it can even be the same dataset, via the admin panel. This way we're not pushing and pulling large text files of data.

khannotations commented 11 years ago

I know, but I'd like them to seed my own database lol. can you email them?

khannotations commented 11 years ago

Also one style thing. Ruby now allows hashes to be like render partial: "header", which is more like json, and also render :partial => "header". I'm wildly in favor of the first syntax since it's clearer and more concise. can we agree to use that for ruby hashes from now on?

eg: { paul: "uncool", rafi: "cool" }

pfletcherhill commented 11 years ago

Yep, I'm fine with the Hash syntax

khannotations commented 11 years ago

Sweet lemme get them young CSV's then :)