Class: Fastui::MPeopleController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Fastui::MPeopleController
- Defined in:
- app/controllers/fastui/m_people_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #login ⇒ Object
- #logout ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/fastui/m_people_controller.rb', line 42 def create @m_person = MPerson.new(params[:m_person]) respond_with(@m_person) do |format| if @m_person.save format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'failure'} } end end end |
#destroy ⇒ Object
66 67 68 69 70 |
# File 'app/controllers/fastui/m_people_controller.rb', line 66 def destroy @m_person = MPerson.find(params[:id]) @m_person.destroy respond_with(@m_person) end |
#edit ⇒ Object
32 33 34 35 |
# File 'app/controllers/fastui/m_people_controller.rb', line 32 def edit @m_person = MPerson.find(params[:id]) respond_with(@m_person) end |
#index ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/fastui/m_people_controller.rb', line 7 def index #limit = params[:limit].to_i #start = params[:start].to_i #search = params[:search] #if search.blank? # @m_people = MPerson.all # @records = MPerson.limit(limit).offset(start) #else # @m_people = MPerson.where("title LIKE :input", {:input => "%#{search}%"}) # @records = @m_people.limit(limit).offset(start) #end #data ={ # :totalCount => @m_people.length, # :rows => @records #} @m_people = MPerson.scoped data = paginate(@m_people) respond_with(data.to_json) end |
#login ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 |
# File 'app/controllers/fastui/m_people_controller.rb', line 72 def login @m_person = MPerson.where(:name => params[:UserName]).first_or_initialize respond_with(@m_person) do |format| if @m_person format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'false'} } end end end |
#logout ⇒ Object
84 85 86 |
# File 'app/controllers/fastui/m_people_controller.rb', line 84 def logout end |
#new ⇒ Object
37 38 39 40 |
# File 'app/controllers/fastui/m_people_controller.rb', line 37 def new @m_person = MPerson.new respond_with(@m_person) end |
#show ⇒ Object
27 28 29 30 |
# File 'app/controllers/fastui/m_people_controller.rb', line 27 def show @m_person = MPerson.find(params[:id]) respond_with(@m_person) end |
#update ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/controllers/fastui/m_people_controller.rb', line 54 def update @m_person = MPerson.find(params[:id]) respond_with(@m_person) do |format| if @m_person.update_attributes(params[:m_person]) format.json { render :json => {:success => true, :msg => 'ok'} } else format.json { render :json => {:success => false, :msg => 'false'} } end end end |