Rails: Multi-Step New User Signup Form (FSM?) [closed] - ruby-on-rails

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I've read the "Create Multi-Step Wizard" in Advanced Rails Recipes. I've also read and re-read the documentation for the updated FSM I'm using called Workflow, and looked here and here. The Advanced Rails Recipe focuses on records (quizzes) that already exist, and doesn't cover creating new ones. The Workflow docs don't cover any code for controllers or views, so I've no idea what to do with all this model magic, and the last two links barely touch on implementation either. From the aforementioned resources, I have a good understanding of what a FSM in Rails is and how to play with it in the console or IRB, but I've got very little direction or understanding how to implement one into my Rails app.
What I would like is this: a simple, multi-step user signup process.
Step 1: User enters in their critical
details (with validations).
Step 2: User enters in their search
criteria, for their profile (with
validations).
Step 3: User agrees to the Terms of
Service (with validations).
Step 4: User is greeted by a
confirmation page, including a link
that takes them to their newly created
account.
I'd also like full navigation between the steps and full capture (saves to the database) with each transition.
Can someone please give me a clear implementation of something similar to this? I would LOVE an example app that includes a multi-step signup process where I can look at the code (FULL source code--models AND controllers and views) under the hood, but I've been unable to find anything like that.
Any guidance would be appreciated!

2020: How to do multi-step forms in Rails
TLDR; You create custom controllers that are just for the wizard flow that are separate from the normal created controllers and further you utilise ActiveModel to do validations along the way without needing to save to the database until the end.

Related

How to document AngularJS + Ruby on Rails app? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm using yard to generate my documentation for Rails apps from an rdoc file. There are AngularJS documentation generators, but how could they be connected to generate one coherent document for an AngularJS + Rails app?
In this case it is probably fine to have them separated, and indeed may make more sense to have them separated. Angular is going to be solely for your client-side stuff, and I'm assuming you're then using Rails as an API or perhaps a different piece of the app's functionality. Either way, they are fundamentally doing different things, so it would make sense to have them in different doc sections.
You could create a "landing page" for your documentation if you'd like: one button links to Angular docs and one to Rails docs, and that would solve the need to have them both "in one place". Actually figuring out a way to make them overlap in the same system is likely not worth the effort though, and may actually be a worse user experience.
As the previous answer stated, it would be good to use two different tools and link them together.
I would start with something like Apipie or just rdoc to document the ruby stuff. Additionally I would search for a good js documentation generator. This article compares a four different generators, while 'Docco' seems to have a ruby port with that is called 'Rocco', that may be even able to generate documentations for both, ruby and js. JSDoc on the other hand enables you to integrate custom pages into your docs (here you could place a link to the apipie generator).
In general I would probably just go for the rails API doc and have some conventions for commenting your angular code, as the angular stuff probably has no API that is accessible by another part of your system and therefore only needs some internal documentation.

How to create a "guided tour" in Rails app? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I'm looking for ideas, best practices, gems (if such exist) that would allow me to easily create a guided tour for an existing Rails 4 web application.
I would like any new user that signs up to be greeted with a welcome message that explains some of the site's features. When they click "Next", they should go to another page (say, projects list) where another explanatory message appears. Next step would be yet another page (e.g. tasks list) with message and so on... I'd like the explanatory messages to be as unobtrusive as possible, similar to flash messages.
The possibility to skip or hide the guided tour and start it over later would be, of course, very nice to have.
I know that I could create it "by hand" using cookies and some additional controller logic (flash messages) but wouldn't like to pollute all of the controllers with additional logic for guided tour.
I've been using Shepherd.js for the last several months in my Rails apps. I found it handles itself best of all the JavaScript tour libraries in a responsive webapp, as the mobile experience is an important part of our product. Plus, its provided themes were easy to integrate into our existing look-and-feel. (You can install the Shepherd.js rails-assets gem for easier use in the asset pipeline.)
I've since wrapped Shepherd.js into a Rails gem called Abraham to make it easier to configure tour content, track which users have seen each tour, and allow users to skip a tour for now.
Another option is IntroJs http://usablica.github.io/intro.js/, both this and Baldrick's answer are great options.
You could use the jQuery plugin Joyride for this.
I would create a controller dedicated to the guided tour that renders some of your existing views (for example '/tour/1', '/tour/2', 'tour/3', ...), but add inside the hidden html ol used by Joyride (see the doc). At the end of the tour on each page, use the Joyride callback postRideCallback to redirect user to the next page of the tour.

single heroku URL with multiple rails apps using same model / authorization from amazon cloud

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 days ago.
Improve this question
I'm using Rails running on heroku. I serve assets on amazon S3. The main URL is mostly static pages. It's time to add some dynamic pages (I think I'll be using amazon for database?), forum, file management (upload/download, tagging), Interactive training, & ...etc.
My thought is to create new apps for each of the dynamic sections of the URL. This will keep slug size down and not allow people on the static pages to use resources of the other "sections" (or apps) and vice versa. So I'll have a users app, forum app, training app,...etc.
Each of these individual apps will need authentication against user accounts. No reason that each app should have individual duplicate user databases... So I'm a bit unclear on how different apps can authorize accounts against the same DB and carry "sessions" over from one app to the next. Is it as simple as ensuring each app has the same database.yml & the same models? Store my sessions into the DB? Use AJAX to call the USER app?
I Don't like that I'm going to be maintaining several repositories that contain the same layout (for consistency) and I THINK the same model & database.yml. But to maximize heroku slug and "refactor" apps it seems like it'll be worth it?
also, should each of these apps be new domains: app1.mysite.com, app2.mysite.com or just mysite.com/app1 mysite.com/app2
I've bee doing lots of learning on kicking off my first dynamic site and am looking for direction & resources to address the multiple app shared DB piece.
Thanks
In my opinion, you should create only one application and store your controllers, models and views in different directories. You will be able to use the same models along your whole site and it will be a lot more easier to maintain.
Also, your session question won't be a problem anymore, and you can organize your routes how you want.

Rails way of breaking down a large form into multiple steps? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
What is the best way to structure a multi-page form to create and edit models in a database?
Is there a "Rails" way of breaking down a large form for a model into multiple steps?
For example, in my HR software, User model has many attributes such as experiences, educations, addresses etc. It would be overwhelming for the user to see all these forms in one page. I would like to break them into pieces and present them step by step instead.
Is there a preferred way of doing this in Rails?
You have two way to do this
1) Using Multistep Forms
2) Using Wizard
You can use state_machine to create multiple step form. Here you can write validations for each state where each state can be assumed as each step in your case. Hope this helps you.

Rails 3 nested form

I have a problem about the nested forms, which I've survey for some possible solutions (Nested form gem, Railscasts) but still have no idea to implement it.
My question is totally based on the solutions above, so please read it if you need :)
Now, my question is:
If i want to add/edit "only one" Question(and it's Answers) per page after I "create/edit" a Survey how could I make it?
In other words, there is only one Question(but could have dynamic numbers of Answers) fields, in the "create/edit" Survey page.
And how to make
add another question,
edit previous question or
remove current question
functions.
I've try to solve this by 2 ways, one is using javascript to hide the previous question each time I add a new one, but in this schema, I can't make my way to edit the existed question.
Another is using Ajax, but ... I have no idea with it.

Resources