Comments (3)
Yeah, it doesn't really "fit" the Rails convention, but then again, how could it, when it is designed not to follow the Rails convention? For the same reason, I don't see how the url_for(options)
can work?
I think Rails (4.0) needs to be updated to be more flexible with regards to path generation. Perhaps it should be possible to register a Route Mapper that can map any sort of hash (or whatever routing object)?
from focused_controller.
Hmm, maybe you are right? Every Action is a kind of Controller. So the #run method should set:
params[:controller] = self.class.name
and `params[:action] = 'run'``
One hacky way to achieve this (see my fork):
def run &block
define_method :run do
params[:controller] = self.class.name
params[:action] = 'run'
instance_eval &block
end
module PostController
class Show < Action
run do
# run code here!
end
end
end
Not sure however, if this would disrupt the use of the `:to` parameter?
from focused_controller.
I think you shouldn't use params
for this. Use the controller_name
and action_name
methods instead. I've made controller_name
work in fb86396.
from focused_controller.
Related Issues (20)
- Consider removing custom assertions HOT 3
- Consider removing `#req`
- Named routes HOT 7
- Routing rspec matcher doesn't works HOT 1
- Readme improvement HOT 1
- undefined method `expose' HOT 1
- Consider action/fragment caching HOT 1
- Weird path bug that displays wrong error HOT 3
- Rabl support? HOT 1
- DSL syntax HOT 9
- Test with RSpec and custom render HOT 4
- RSpec and included member routes in a resource HOT 2
- Session values accessible, Cookies private? HOT 2
- assert_template only works when explicitly calling render
- Tests don't run HOT 4
- Rails 4? HOT 4
- Rails 4.1 support?
- Instance variables not available in template HOT 2
- Rails 4.2 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from focused_controller.