Creating a Rails application for a trial period of x days is pretty easy.
You want to implement a 30-day trial period for your users, and then follow these steps:
step 1: create these methods in application_controller.rb, for example
# application_controller.rb class ApplicationController < ActionController::Base
Step 2. Display the remaining days of judicial days in application.html.erb
# application.html.erb <html> <head></head> <body> <span style="color:red"> Your trial period will expire on <%= remaining_days %></span> Days. Suscribe </body> </html>
step 3: write in each controller
class YourController < ApplicationController before_filter trial_expired? end
so if the trial version has already expired, it will not allow access to your page, but will redirect the user back to the error message page.
Now create one expires controller and perform all the necessary function. The expires> index page displays some error message like "Your trial period is completed, please subscribe .................", whatever you want.
This works for me.
source share