Project

michibiki

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Michibiki is auto redirector if user's condition is match
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 4.2.0
 Project Readme

Michibiki

sample code

Gemfile

gem 'michibiki'

config/routes.rb

Rails.application.routes.draw do
  resource :profile, only: %i(edit)
  mount Michibiki::Engine => "/michibiki"
end

app/controllers/application_controller.rb

class ApplicationController < ActionController::Base
  before_filter Michibiki::Strategies::ProfileEditing
end

app/filters/michibiki/strategies/profile_editing.rb

class Michibiki::Strategies::ProfileEditing < Michibiki::Base
  private
  def trigger_conditions
    retuen unless current_user
    !current_user.ready_profile?
  end

  def redirect_path
    '/profile/edit'
  end
end

app/views/profiles/edit.html.slim

= form_for(@user) do |f|
  = f.text_field :nickname
  = f.submit

= form_tag michibiki.skip_path('profile_setting_redirector'),  method: :put do
  button skip