similar to: Admin and standard controllers RESTFully

Displaying 20 results from an estimated 3000 matches similar to: "Admin and standard controllers RESTFully"

2006 May 31
5
Sharing code between some controllers? Staying DRY
Hi, I have four controllers: one for the store front and three for the store admin. In each controller I have copied and pasted exactly the same code. It is a method called redirect_to() to override Action Controller''s redirect_to(). Copy and paste is bad. I can think of two options but I don''t know how Rails will feel about them. Option 1: Can I create an intermediate
2006 Jul 23
2
REST controller with up and down for model that acts_as_list
Hi, I have the following models class Department < ActiveRecord::Base has_many :products end class Product < ActiveRecord::Base belongs_to :department acts_as_list :scope => :department_id'' end When I look at a list of products for a particular department I have up and down buttons to re-order the products. Currently my controller is something like this class
2005 Jul 15
5
Nested Controllers
Hi there, I wondered if anybody had any experience with having nested controllers?For example, I''d like a hierarchy something like this: /product /product/list /product/detail /product/detail/category I can''t find any documentation on this, so any advice/experience anybody might have would prove useful. N.B. This is for a generator which builds Views and Controllers
2006 Aug 10
6
Login Restfully
In DHH''s keynote, he alluded to doing logins with REST. Has anyone implemented this, and if so, would you mind elaborating on how you did it please? Thanks in advance. -- Posted via http://www.ruby-forum.com/.
2011 Sep 21
5
problem with submit button in rails 3
hi, i am using <%= s.submit ''Product save'' %> when i click it, following error appears " Routing Error uninitialized constant ProductsController" could any one provide me solution ? thanks, -pab -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send
2006 Apr 24
3
quick q on script/generate scaffold
I want a scaffold to manager both products and users. To get the products scaffold I used script/generate scaffold Product Admin if I use, script/generate scaffold User Admin will it overwrite my product admin controller? Would I be better off doing script/generate scaffold User User_Admin or something? -- Posted via http://www.ruby-forum.com/.
2012 Feb 10
3
Schwefel Function Optimization
All, I am looking for an optimization library that does well on something as chaotic as the Schwefel function: schwefel <- function(x) sum(-x * sin(sqrt(abs(x)))) With these guys, not much luck: > optim(c(1,1), schwefel)$value [1] -7.890603 > optim(c(1,1), schwefel, method="SANN", control=list(maxit=10000))$value [1] -28.02825 > optim(c(1,1), schwefel, lower=c(-500,-500),
2012 Feb 10
3
Schwefel Function Optimization
All, I am looking for an optimization library that does well on something as chaotic as the Schwefel function: schwefel <- function(x) sum(-x * sin(sqrt(abs(x)))) With these guys, not much luck: > optim(c(1,1), schwefel)$value [1] -7.890603 > optim(c(1,1), schwefel, method="SANN", control=list(maxit=10000))$value [1] -28.02825 > optim(c(1,1), schwefel, lower=c(-500,-500),
2007 Nov 10
0
Find or create RESTfully
Hi all, I am building a system and trying to do it RESTfully using the new and improved Rails 2.0RC1 and I am not sure how to structure a find or create action. Basically, I want a user to be able to add a line item to a list based on vendor. The user has to select the vendor and enter the product information. When they submit the system will find a list already exists for that vendor or
2006 Aug 14
1
Rest, routes, path_prefix and default params
I am trying to use routes with default params to have routes ''/mycompany/departments'' and ''/companies/1/departments'' mean the same thing (both restful routes). When I set up the files as below, I get an error of ''Couldn''t find Company without an ID'' and my log file shows the following .. Processing DepartmentsController#index (for
2009 Jul 09
8
Only One Controller + Urgent
Hi Champs, Need Help .. :( Actually the thing is that i am having many controllers a, b, c and d.. But what i want it that only "a" should be displayed to the users .. b, c, d not .. Is there any way to do it .. ? Cheers .. -- Posted via http://www.ruby-forum.com/.
2006 May 31
2
calling routing during a functional test
I had a beginner''s question. I am testing the create action on my controller. I wanted to fetch the ID parameter of the newly created object, so that I can make some assertions on it. But I can''t seem to find an elegant way of doing that. Of course, might create action redirects. That means that @response.redirect_url is something like "/show/8". So I could pluck
2006 Jul 26
5
Can we have have protected methods in our REST controllers?
I gotta be quick, sos if it seems rushed. Latest word from DHH is that the REST conttrollers should only have 4 methods : Create, Update, New, Delete If you don''t know about DHH''s latest thing then leave now, or go read about it on his blog. Does this mean i can''t have private methods in my controller?? I have a method that create and new share. Thanks Chris
2007 Sep 02
17
A Proposal To Magically Remove ''params''
I have a magical proposal for the anti-magic web framework. Controller methods do not use arguments and yet expect arguments. This is handled through this params hash because we don''t know in advance what parameters a client could pass to Merb. But in almost every instance, it is too much to know all the query parameters - one doesn''t care if the user threw in an extraneous
2007 Aug 29
2
DRY specs for RESTful controllers
Hi, I''m developing a RESTful Rails application whose code and specs are becoming increasingly repetitive: every controller does pretty much the same set of things (give or take the occasional twiddle), for example, and so every controller spec is almost identical modulo some names, constants and strings. The make_resourceful plugin, which autogenerates the boilerplate REST
2006 Oct 18
1
observe_field, GET method and RESTful controllers
Hi all. I am trying to work with restful rails and have come across a quandry with observe_field. I basically want the observe field to call a show action on a restful controller. However I am unable to do so because I cannot get the damn thing to use the get request properly. If I use the following: <%= observe_field("project_selector", :update =>
2009 Sep 30
1
2 RESTful controllers for the same resource
Hi everyone I want to have two restful controllers for the same resource (Users) One controller (UsersController) is straight in the controllers folder and is used for singup and so on Then i need another controller for users which is inside an admin folder (Admin::UsersController) In my routes.rb i have map.resources :users # Sample resource route within a namespace: map.namespace
2006 Oct 09
1
restful authentication - filtering out login ??
i am unable to reach the login page when adding ''before_filter :login_required'' to the application controller. I HAVE added the following to my sessions controller ''before_filter :login_required, :except => [:new, :create, :destroy]'' I figured this would overload the app controller filter but i get this loop while it looks for sessions/new and isnt allowed
2006 Aug 01
2
restful controllers - howto nest with link_to?
Hi List, I''m trying to get my grip on the restful methods that are now part of edge rails. Making the first steps was impressive as well as easy because there are already great resources on the blogs of early adopters: http://www.ryandaigle.com/articles/2006/08/01/whats-new-in-edge-rails-simply-restful-support-and-how-to-use-itand
2006 Feb 13
2
categories and admin/categories - different controllers and templates?
Is there some way to have these two sets of URLs use totally different controllers and templates? categories/list categories/show/1 admin/categories/list admin/categories/edit/1 admin/categories/destroy/1 admin/categories/update/1 Besides, of course, using different controller names ;). The first URL is publicly accessible, while the second contains admin functions. Also, with the second,