similar to: Number of actions per controller

Displaying 20 results from an estimated 10000 matches similar to: "Number of actions per controller"

2006 May 15
3
large controller
Hello there, I have been thinking about this for some time now, but I am not experienced enough using Rails to solve the Problem on my own. I have a Rails application that has an admin section, from where you can, well, administer the whole thing. I have CRUD functionality for several data structures there. So the controller is getting big, and I don''t want that, but I feel I have
2006 Aug 05
0
Another generic CRUD controller
I''ve been using this template on most of my CRUD controllers. class CommentsController < ApplicationController meantime_filter :set_scope before_filter :find_comment, :only => %w(show edit update destroy) def index @comments = Comment.find(:all) end def new @Comment = Comment.new end def create @comment = Comment.create!(params[:comment])
2006 Jan 12
2
reversing paginated lists, linking to last page from controller
Hi I use the scaffolded generated crud to handle my entries, and I cannot figure out how to reverse the list, what with the pagination. I can reverse the entries on a page, but not the entire paginated list. Also, it would be helpful to me to be able to redirect to the last page of a paginated list when I destroy, i figured out how to add such links to the view, but how to get from the
2006 Dec 10
5
model-controller-paradigm: What about admin controllers?
Hi all We all know the model-controller-paradigm: I have a model "News" which has a corresponding CRUD-controller "NewsController". But now I''m quite unsure about the following... Guess we have normal visitors that visit our site www.??.com/news and we have administrators that create and modify news items. The admin should see an "Edit" link and a
2006 Jul 27
0
Controllers, Models, and Validations...
Hello, After listening to DHH''s 2006 RailsConf keynote, I decided to take a leap on my current application and do a little more re-organizing to make it more CRUD-based. As such, I ended up changing some things around to get this (simplified): User has_many :enrollments, :conditions => ''status > 0'' User has_many :schools, :through => :enrollments User has_many
2006 Oct 16
0
Restful routes, not repeating yourself and non-standard rest actions best practices
So I''ve recently started playing with the restful routes support in edge rails, converting a few of my controllers to support all the standard operations.. One thing that''s been bothering me, however, is the following: Before using restul routes, I would define an edit method in my controller which would be responsible for both creating new objects as well as editing
2007 Mar 19
3
controller_name with dynamic controllers
I''m writing a controller which should only be inherited from, something like the generic crud controller seen here: http:// geekonomics.blogspot.com/2006/07/crud-and-shared-controllers.html Now, in my spec, I would like to create a controller which inherits from the generic CRUDController, without actually creating the controller. This controller is *only* for testing. How can I
2007 May 22
2
Refactoring controllers vs. actions
I just completed an exercise of breaking down an existing project and mapping out the controllers and actions, then re-factoring them into some perhaps more RESTful. Though I could be wrong since I am still grasping REST. Most of the controllers mapped perfectly into a REST structure, except for a few. I have Messages, which can respond to all the usual actions, plus a few more. The extras are
2007 Mar 24
1
spec''ing metaprograming & rails CRUD
For edge rails there is a Crud generator. There is also a CRUD controller that is out there from which you can inherit your other controllers (see http://geekonomics.blogspot.com/2006/07/crud-and- shared-controllers.html) This got me thinking about Crud controllers in general. As far as I know, the generator can''t produce crud classes which are nested (i.e.
2012 Jul 03
1
View with Variable Number of Fields
I''m a relative n00b when it comes to Rails. I''ve gone through Michael Hartl''s tutorials (both editions, books and screencasts) and I can build a basic CRUD web app without help. However, for a personal project I''m working on, I''m lost as to how to move forward. Here''s the situation ... I have a model called Project with two fields,
2006 Mar 17
2
Controller/View Organization (Newbie Question)
Good afternoon all... First, let me apologize for asking a potentially dumb question. I''m new to both Ruby and Rails, but I do have a long background in OO programming and web development. My question is about how to structure controllers for the various models which I will need in my application. My data will look something like this: Dog - (has_many) TrainingSessions -
2007 Mar 24
0
Using spec fixtures with integration tests
Hi all, How can I use spec fixtures with rails integration tests ? I''ve tried adding {{ fixtures "../../spec/fixtures/myfixture" }} to the integration test but the fixtures are not loaded when I run the rake task. Rails doesn''t load symlinked fixtures either so I copied the files from spec/fixtures for the time being. Not very DRY. Any ideas ? Keith
2006 Mar 28
5
combining two models in one controller/view "set"
I''m going to take another stab at this question (my first one received no replies): I have two models: Author has_many: books Book has_one: author I have two tables: authors id ... books id author_id ... I let the scaffolding fly and it created the CRUD goodness for each model, as expected. However, I want to have only one view/controller "set" for both models; when I
2014 Mar 01
0
Rails controller problems
1. Users_Controller CRUD expects param[:id] to create User instance. With Orders_Controller, I'd like to retrieve a list of users who have ordered. I know Orders_Controller expects param[:id] to be for creating Order instance. So does this mean if I want to retrieve a list of users who have ordered, I should create a method called 'get_orders' in Users_Controller? 2. Can
2008 May 26
7
Mocking Models in Controller Specs...
I find myself doing this kind of thing a lot in Controller Specs: @vacancy = mock_model(Vacancy) @vacancy.stub!(:reference) @vacancy.stub!(:title) @vacancy.stub!(:created_at) @vacancy.stub!(:updated_at) @vacancy.stub!(:body) @vacancy.stub!(:contract) @vacancy.stub!(:location) @vacancy.stub!(:salary) @vacancy.stub!(:benefits)
2006 Aug 14
1
Testing CRUD/Rest Controllers
I have a few simple controllers doing plain, simple crud in a standard way. now it''s not very DRY to write a funtcional test for each controller, since they are all doing the same (apart from a few variable names, but that could be easily inflected or so). is there a way to do this? e.g. does inheritance work with tests, so i define a base test first, inherit my other tests and add a few
2008 Sep 10
0
wrong number of arguments
I am a newbie at rails and can''t figure out the following problem. Can anyone help? I am running the following: Ruby version 1.8.6 (powerpc-darwin9.4.0) RubyGems version 1.2.0 Rails version 2.1.0 Active Record version 2.1.0 Action Pack version 2.1.0 Active Resource version 2.1.0 Action Mailer version 2.1.0 Active Support version 2.1.0 I created three models using the:
2006 Aug 18
0
Impact of inheriting controllers on models
I have some protected methods and authentication/acl filters I want to inherit down through my controllers. So I have controllers which inherit like this: Application_controller \ -- AdminArea Controller --\ ----dashboard controller ----user controller ----content controller ----\ ------page controller ------placement controller -- PublicArea Controller --\ ........ At the deepest level the
2006 Jul 04
0
Multiple and nested controllers or routing
Hi, I''m new to Ruby and Rails and I''m making a simple application to help me learn how to use it. At the moment I have an admin controller. When the user goes here I want them to be presented with 3 choices: manage photos, news and pages. From there I want them to be able to CRUD each type. At the moment in the admin controller I''ve defined actions "photo",
2006 Nov 04
0
Controllers and Namespaces (no problem, just questions)
I''m a little late on finding this article: http://habtm.com/articles/2006/07/01/if-your-models-arent-namespaced-why-should-your-controllers-be-or-how-i-learned-to-stop-worrying-and-love-the-crud This idea does not sit well with me and am curious as to the Rails roadmap. I''ve seen a couple things demonstrated in examples (Rails Book, api) that later turn to become deprecated. As