I have a view for a controller called "show". Inside that view, i want to render the contents of another controller's view - and obviously, the logic for the form on that view to talk to the controller it belongs too. How do I do this? I am fairly new to rails and I'm not 100% confident with the framework yet.
You could almost consid...
I have the following form:
<% form_for(:tag, :url => {:action => "post_tag", :id => @photoID}) do |form| %>
<%= error_messages_for(:tag) %>
<% if @errors then %>
<%= @errors[0] %>
<% end %>
<p><%= form.select(:user_id, @userHash) %></p>
<p><%= form.hidden_field(:xpos) %></p>
<p><%= form.hidden_field(:ypos) %></p>
<p><%= ...
I have a controller called form_questions_answers with a method in it called modify_rule but when I perform a post to /form_questions_answers/modify_rule/60 Rails tells me:
Routing Error
No route matches "/form_questions_answers/modify_rule/60" with {:method=>:post}
Why is this happening, I have map.resources :form_question_answers in...
I'd like to be able to DRY-ly and intelligently set up my Rails controllers so that I can effortlessly use paginated tables of data on various pages. Let me clarify. I already use will_paginate + a custom plugin that I wrote which acts as a table-view creator. This combination works perfectly for "index" actions which simply show one ...
Is it possible to get all controllers available to a ControllerFactory?
What I want to do is get a list of all controller types in application, but in a consistent way.
So that all controllers I get are the same ones default request resolution is using.
(The actual task is to find all action methods that have a given attribute).
...
I'm new to zend framework and I want to ask if is it possible to have a base controller that will be extended by all other controllers? I want to have a base class wherein I'll put all common methods and properties for all controllers I'll have on my project. Is it advisable to do this with zend or is there a better approach to this?
...
when unit testing a asp.net controller, don't you have to somehow mock the httpcontextbase?
All my controllers inherit from a custom controller class that I wrote (it just adds some common properties to the original controller class).
So its like:
public class MyController : Controller
{
protected override void OnActionExecuting(Sy...
I can't seem to get the number of view controllers in the view controller stack.
NSUInteger *viewControllerCount = self.navigationController.viewControllers.count;
I can loop through the view controllers and NSLog the objects within but I can't do a simple count. If I try to access this pointer, the ap crashes... no Log, no error mess...
Hi there, Ihaven't done much MVC and still learning the hard way on how to do things.
MVC 1 and C#
The Problem
I want to provide a customer with a link such as www.temp.com/redirects/cust100?id=123&url=www.nothere.com
from the URL i know it will go to the controller of "redirects" but there isn't an Action of "cust100". How do i creat...
Hi all,
I'm trying to send a variable through a link_to, without using url query in Ruby on Rails, from one controller's index view to be used on another controller's index.
Basically, I need to pass the Turma.id (school class id), to the Elementos_turma(peoples in the class) controller, so I can use it and filter the index: ElementosT...
Controllers can become large and unwieldy when they contain large numbers of actions. Is this a significant problem in real-world use, and if so what are the strategies to mitigate it (or is is good enough to simply keep the action-count down per controller)?
Off the top of my head I can envisage the controller offloading the logic to a...
I am trying to simplify the process of inserting data into my database, so I have constructed a model that handles the variable extraction and data inserting.
I understand that this model embodies a function, and then you call this function (such as /controller/model) and pass the relevant data through the model for processing. However,...
I have controller methods that look like this:
class TestController < ApplicationController
def testAction
render :json => { 'success'=>1 }.to_json
end
end
When I load this action in the browser, I get what I expect: {"success":1}
When testing with RSpec, however, response.body gives me '<html><body>You are being <a href="htt...
What are best-practices (or usual-practices) when it comes to adding more steps in a process in Rails?
For example, I am working with the Spree e-commerce Rails platform and I would like to add a multi-step form people should fill out when trying to "Add to Cart" a Product.
The current spree implementation of adding a product to the ca...
I have 3 view controllers. Main view (controller1's view) is displayed first. Based on button selection the 2nd view (controller2's view) is displayed. There are several buttons and a home button on this view. Selecting those will display 3rd view (controller3's view) with animation.Selecting home button will display the main view(contro...
Hi all,
I'm using the Zend Framework for my website, and just created a special module "api" to create... Well, an API.
Now, I have a lot of controllers in my module and I'd like to create subdirectories in this controllers directory in order to "tidy" it. My new structure would be something like this :
- controllers/
- controllers...
I am a big fan of optional parameters in C#4 but am having an issue with MVC when I use them in my controller constructors. For example, if I have a single constructor:
public TestController(sting a = "") { /* blah */ }
MVC has a fit saying that there are no parameterless constructors for TestController.
How can I get around this?
...
Hey,
I am creating a kinda gallery and for each gallery I created a view controller whose view is added to a scrollview (see code below) :
GalleryViewController *galViewController;
for (NSUInteger i = 0 ; i < [galleries count]; i++) {
galViewController = [[GalleryViewController alloc] init];
galViewController.record = [galleri...
I have the following controller:
public ActionResult Search(string Name, int? Friend, int? Page)
It works if I use this url localhost/users/search/name but these don't localhost/users/search/name/1 and localhost/users/search/name/1/1
...
Hy,
my controller example:
class FriendsController < ApplicationController
before_filter :authorize, :except => [:friends]
##############
##############
## REQUESTS ##
##############
##############
##################
# GET MY FRIENDS #
##################
# Get my friends.
def friends
@frie...