sorcery icon indicating copy to clipboard operation
sorcery copied to clipboard

Add to Rails template libraries.

Open joshRpowell opened this issue 5 years ago • 6 comments

Sorcery is fantastic. I’ve worked on a few Rails implementations. These services could spread the love.

https://www.rubidium.io/

https://railsbytes.com/

I see Devise listed. Any interest in setting up some templates? 👍

joshRpowell avatar Jun 03 '20 10:06 joshRpowell

I have my own rails template setup that includes Sorcery, but it's more specialized for my own re-usability needs: athix/rails-template

I like this idea, but don't have time to implement it personally. Maybe someone could take an existing template and make a more general Sorcery template?

joshbuker avatar Jun 03 '20 16:06 joshbuker

Hi guys ! I'd be glad to help on this :D I am not completely sure about what you want : a template available from a website ? Or a rails boilerplate with Sorcery that people could just re-use ? Or both 🤷‍♂️

I never created a template from railsbytes, so I'd just give it try with something like this, based on the one for Devise and Sorcery's doc :

run "bundle add sorcery"
run "bundle install"

rails_command "generate sorcery:install"

model_name = ask("What do you want to call your Sorcery model?")
attributes = ""
if yes?("Do you want to any extra attributes to #{model_name}? [y/n]")
  attributes = ask("What attributes?")
end

# We don't use rails_command here to avoid accidentally having RAILS_ENV=development as an attribute
run "rails generate sorcery:install --model #{model_name} #{attributes}"

Vin0uz avatar Jan 25 '21 22:01 Vin0uz

Hi everyone, I see this issue hasn't moved in a while and I wanted to try my hand at it. I've created a Sorcery template here: https://github.com/ditsara/sorcery-rails-template

Basically all you need is the template.rb file (I've combined all the generated files into it).

Can I get your feedback? I've only done some light testing so far.

ditsara avatar Aug 29 '21 08:08 ditsara

@ditsara I took a quick look, and one thing I would consider is moving from inline templates within template.rb, to copying template files. You can also apply other files to split it up into logical chunks.

joshbuker avatar Aug 29 '21 18:08 joshbuker

Okay, I see. Is there any convention around this? IE to ensure it works when fetching via HTTP vs local.

I'll take another look this coming weekend.

ditsara avatar Sep 02 '21 14:09 ditsara

Yeah, the methods I mentioned are built-in iirc, and work when using it in either remote fetch or local.

joshbuker avatar Sep 04 '21 00:09 joshbuker