search for: carscontroller

Displaying 3 results from an estimated 3 matches for "carscontroller".

Did you mean: cardscontroller
2010 Aug 01
3
Problem with non-ascii characters in forms: "incompatible character encodings: UTF-8 and ASCII-8BIT"
...8 and Rails 2.3.8. I was creating a minimal application to test handling of Norwegian special characters when I bumped into this strange problem... I have a simple Car model with fields maker:string and model:string. For the controller I planned to just have an index action do all the work: class CarsController < ApplicationController def index if request.post? @car = Car.new(params[:car]) @car.save end @cars = Car.find(:all) end # def create # @car = Car.new(params[:car]) # @car.save # redirect_to :action => :index # end end The corresponding view lists all c...
2007 Aug 16
1
Nested REST resource routes without controller name
...orvette was produced. I want a POST request on /car/corvette to be used for adding new years. Essentially, I want the ability to nest resources, without specifying the nested resource name. I know how to do this without using the resources API, so I''m not looking for a workaround. In the CarsController, I would access a car with params[:id]. In the CarYearsController, I would access a particular year of a car by using params[:car] and params[:id]. (The :id would be the year). Is this just a bad idea? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are...
2008 Jul 22
2
ActiveRecord Associations issue
...nd has_one :car, :through => :models validates_associated :brand validates_presence_of :brand, :message => ''is unknown'' end class Marca < ActiveRecord::Base has_one :model, :through => :brands end # Controller (only index action needed for the example) class CarsController < ApplicationController def index @cars = Cars.find(:all) end end # The view <table> <tr> <th>Brand</th> <th>Model</th> <th>Photo</th> </tr> <% for car in @cars %> <tr> <td><%=h car.model.br...