3
votes

I have an EmberJS app which was from the yeoman template and is built independently in a GruntJS build.

The Ember app talks to a rails-api backend, and in dev I use grunt-connect-proxy to proxy localhost:3000 to localhost:9000 so I can use my GruntJS setup to build the assets. In prod I put the build output into the public folder.

I'm trying to implement authentication with Devise. I'm fine with emberjs, but I am not very experienced with Rails or Devise and I'm not having a lot of success finding a good approach to using it with my setup. I've see examples using token_authenticatable but also have read that it has been deprecated in Devise so I guess I shouldn't use that? I've also seen this example for apps using rails asset pipeline .

Here are my options

  • Try to figure out a way to authenticate using my current setup of ember+grunt separate from the backend rails-api with devise. All login has to be done through ajax and I can't use rails to render anything out to the views. Any examples of this anywhere?

  • Put my ember app into rails so that the asset pipeline can be used to render out stuff. Try to do ajax login for nice UX

  • Put ember app into rails and just do full post back for auth. Probably easiest option.

Any advice?

1

1 Answers

0
votes

I'm currently looking to do something very very similar but with AngularJS. Sadly I don't have an exact answer for you however I'm reading through the Discourse repository as they use Rails/ember. you might find it helpful. I know I have.

https://github.com/discourse/discourse