I have read through the Rails docs for Routing, Restful Resources, and the UrlHelper, and still don't understand best practices for creating complex/nested routes. The example I'm working on now is for events, which has_many rsvps. So a user's looking through a list of events, and clicks register, and goes through a registration proces...
As I am learning more about rails, and breaking my design thinking from ASP.Net days, I was considering a scenario this morning but did not know if it was possible to do.
Practitioners have many Treatments through services - and vice versa
In my control Panel I have an area for Practitioners to edit their details (names, contact info e...
I've got something like this in my routes.rb:
map.resources :retailers, :has_one => [:invite_code]
map.resources :invite_codes, :member => {:redeem => :get}
and it isn't generating a route that I would expect:
http://localhost:3000/retailers/1/invite_code/redeem
Am I doing it wrong?
...
I have a named route:
map.find '/find/:category/:state/:search_term/:permalink', :search_term=>nil, :controller=>'find', :action=>'show_match'
and the following URL matches it & works OK:
http://localhost:3000/find/cars/ca/TestSeachTerm/bumpedupphoto-test
but if I take out the 2nd last parameter i.e. "TestSearchTerm", then the rout...
Hi,
I have 2 models, Assessments and Questions. Assessments have many questions.
In routes, I have:
map.resources :assessments, :has_many => :questions
map.root :assessments
I checked rake routes, it's as expected
On the form to create a new question, I get the following error:
undefined method `questions_path' for #<ActionView::B...
Right now I'm building a project management app in rails, here is some background info:
Right now i have 2 models, one is User and the other one is Client. Clients and Users have a one-to-one relationship (client -> has_one and user -> belongs_to which means that the foreign key it's in the users table)
So what I'm trying to do it's on...
I have my file structure set up appropriately ( I think ! ) , and claims nothing responds to show.
My file structure :
views/admin/admin_wysi/index.html.haml
My controller ( controllers/admin/admin_wysis_controller.rb )
class Admin::AdminWysisController < Admin::ApplicationController
def index
end
end
My routes.rb
map.name...
G'day guys,
Having a bit of an issue with Rails routes, at the moment.
Have a top resource: /Customer/ which itself has only one /Quote/ resource
Quotes can have both first_resources and second_resources
which are collections of resources associated with the quotes
Building the route, though how do I nest multiple routes under a has...
I'm attempting to use nested controllers that have restful pathing, so that I'm all organized and such. Here's a copy of my routes.rb so far:
map.root :controller => "dashboard"
map.namespace :tracking do |tracking|
tracking.resources :companies
end
map.namespace :status do |status|
status.resources :reports
end
Li...
I have a comment form (in comments/_form.html.erb) that I use in my other controllers (posts and tags).
<% form_for([@post, Comment.new], :html => { :multipart => true }) do |f| %>
<%= f.text_field :commenter %>
<%= f.text_field :email %>
<%= f.text_area :body %>
<%= f.submit 'submit' %>
<% end %>
In my Comment mo...
I have 2 models - User and Activity - which are related by a has_many :through using the UserActivity model. A User can either "want" or "done" an activity, which creates a UserActivity record and sets the appropriate boolean.
What would you recommend for handling these actions when creating routes and controller actions? Would somethin...
I have a rails 3 application very similar to the one in Railscasts episode #229 the only difference is that in my code Articles is called Posts and I have a nested route:
routes.rb:
Myapp::Application.routes.draw do
resources :posts do
resources :comments
end
root :to => "tags#index"
end
I receive this error in the terminal...
Hi all
I think I am thinking about routing all wrong. I have a very simple, two model set-up: Product and Photo. Product has_many :photos, and Photo belongs_to :product.
Product has a full scaffold while Photo has a photos_controller that I am working on.
In routes.rb we have:
resources :products (generated by the scaffold)
As phot...