Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
simple_controller
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
simple_controller
Commits
29ae1a2f
Commit
29ae1a2f
authored
Dec 28, 2017
by
liyijie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use BaseController instead of Base, fix the problem
parent
0980148c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
controller.rb.tt
.../simple_controller/templates/controllers/controller.rb.tt
+1
-1
simple_controller.rb
lib/simple_controller.rb
+1
-1
base_controller.rb
lib/simple_controller/base_controller.rb
+4
-4
No files found.
lib/generators/simple_controller/templates/controllers/controller.rb.tt
View file @
29ae1a2f
class <%= controller_class_name %>Controller < SimpleController::Base
class <%= controller_class_name %>Controller < SimpleController::Base
Controller
view_path '<%= view_class_path %>'
<% if auth.present? %>acts_as_auth_action :<%= auth.downcase %><% end %>
...
...
lib/simple_controller.rb
View file @
29ae1a2f
...
...
@@ -7,5 +7,5 @@ require 'inherited_resources'
module
SimpleController
autoload
:VERSION
,
'simple_controller/version'
autoload
:Base
,
'simple_controller/base
'
autoload
:Base
Controller
,
'simple_controller/base_controller
'
end
lib/simple_controller/base.rb
→
lib/simple_controller/base
_controller
.rb
View file @
29ae1a2f
class
SimpleController
::
Base
<
::
InheritedResources
::
Base
class
SimpleController
::
Base
Controller
<
::
InheritedResources
::
Base
respond_to
:json
def
index
...
...
@@ -23,7 +23,7 @@ class SimpleController::Base < ::InheritedResources::Base
@view_class_path
end
#
def collection
#
get_collection_ivar || set_collection_ivar(end_of_association_chain.ransack(params[:q]).result.paginate(page: params[:page], per_page: params[:per_page]))
#
end
def
collection
get_collection_ivar
||
set_collection_ivar
(
end_of_association_chain
.
ransack
(
params
[
:q
]).
result
.
paginate
(
page:
params
[
:page
],
per_page:
params
[
:per_page
]))
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment