similar to: Scaffolding for pre-existing database table in 2.0.1

Displaying 20 results from an estimated 20000 matches similar to: "Scaffolding for pre-existing database table in 2.0.1"

2007 Dec 27
17
2.0 & "Agile Web Dev..." book
Just running through the first little project (depot) in ''Agile Web Development with Rails''. It isn''t scaffolding like it says it should in the book. After running: >rails -d mysql depot then SQLing: drop table if exists products; create table products ( id int not null auto_increment, title varchar(100) not null, description text not null, image_url varchar(200)
2006 Jan 12
9
Scaffold shows all attributes altough I use attr_accessible!
Hi all I have a Model like this: class Member < ActiveRecord::Base attr_accessible :username, :email, :first_name, :last_name end I have created a scaffold using script/generate scaffold member members Using the URL localhost:3000/members/edit/1 I can edit all attributes, including created_at, lock_version etc.! But it should only show the attributes I listed in attr_accessible! What
2008 Feb 24
3
1 error(s) on assignment of multiparameter attributes
I am trying to create a form for processing credit cards. For the credit card expiration date, I would like to leave the day field out of the form for obvious reasons. However, the following code is producing an error for me. Any ideas? Thanks! <p><label for="email">Expiration</label><br/> <input type="hidden" id="user_card_expiration_3i"
2005 Aug 18
10
Scaffolding, DRY and RHTML
Hello all, I''m working on a couple of Rails projects at the moment and have noticed something that seems to go against the DRY principal. Why, when scaffolding, are individual CRUD rhtml files created instead of using one as a partial and having the others use that single partial? This especially applies to the list rhtml. I am about to get to the other operations and see how feasible
2007 May 30
4
aaf and dynamic attrs: a bug?
Hi! I faced some issue while using it for dynamic attrs indexing/search. Maybe I made something wrong. Here is test method. Everything works just fine until last line http://pastie.caboo.se/66274 . Tested on both stable and trunk of aaf and ferret 0.11.4. the short version of code below: Contact.acts_as_ferret :fields => [ :first_name ] assert
2007 Aug 26
2
Multi-word query searching across columns
I''m trying to implement a basic name search on a People table with separate first_name and last_name columns. I am using the will_paginate plugin and have the following search method in the model: def self.search(search, page) paginate :page => page, :conditions => ["lower(last_name) like ? or lower(first_name) like ?",
2010 Oct 05
2
Is it possible to query on virtual attributes?
I have a Person model with attributes first_name and last_name. I want to implement autocomplete search that looks that the entire name. Hence I have a method: def full_name self.first_name + " " + self.last_name end Is it possible for me to query on full_name and have rails match the first_name and last_name fields? I currently receive this error when I try, because full_name
2008 Nov 08
8
scaffold not working like i hoped......
Hi: i''ve tried this on three macs (tiger, panther, etc).. and my ROR is up to date on each. My models and controllers aren''t displaying all my mysql db fields. When I run script/generate scaffold Planner ... it builds the controller, model, and all the rest. When I go to test the app and new controller, now called planners no content is listed... and all I ever get is the
2006 Jan 10
15
KISS and DRY? Not even close!
Hi all, After working on my first rails app and having handed over some very sophisticated coding from a lot of you guys. My app does what I want it to do, but I''m no where near the end yet, and it seems that the KISS and DRY objectives already went down the drain. It could be lack of knowledge, only doing Ruby on (and) Rails for a month, but I''m stuck on the following:
2005 Dec 26
16
How to create application with single table with primary key
I''m trying without any succes to create application in which I have one keyed table. The table structure is: CREATE TABLE employees ( pin INTEGER PRIMARY KEY, first_name VARCHAR(30) NOT NULL, last_name VARCHAR(30) NOT NULL ); Whenever I enter new record, I need the the filed pin is also filled by user. Whenever a user edit the table, there should be option to edit or not edit the
2006 Jan 25
7
join fields for list views
I am sitting with the Agile book on my desk and scratching my head at the discussion on aggregation - perhaps that isn''t what I need. I have a db called clients. fields include - first_name middle_initial last_name I want to combine them all into one name element in a list view. I can add/edit the fields separately but in the list view, I only want the one combo field. Is there a
2006 Aug 07
8
Login form question
I''m using Rails Recipes to create a login form but instead of username and password, my setup is firstname, lastname, password. I seemed to be gramatically challenged and not sure how to set up the parameter list. Can anyone offer up a suggestion. The book shows the method starting like: if request.post? user = User.find(:first, :conditions => [''username = ?'' ,
2006 Jun 23
3
form_remote_tag is not passing form params
I''ve searched and searched and searched again, and I cannot find any help with this problem. There''s an identical problem on this forum, but it was never resolved. I''ll try to re-open the subject with a bit more information. Problem: The form_remote_tag() method in my "list" view is not passing the params[] hash of the values stored within my form.
2007 Dec 28
11
LIKE clause in rails
Hello, I am trying to achieve a search functionality in the following manner i have an table called people which has first_name,last_name,etc... After the user form to search people is submitted i get the params hash as params[:persons]={"first_name"=> "%John%","last_name"=>"%Stevens%"} NOTE : I have changed the params hash to include the %. Now
2006 May 17
5
text_field_with_auto_complete (newbie question)
I have the text_field_with_auto_complete woking on my user DB using last_name. so looking for ''ivanoff'' works great, but I can''t find ''john''. Plus I like to have ''last_name, first_name'' show up in the dropdown. what I can''t figure out is how to concat first_name and last_name to make a name and use that to look it. working
2007 Jul 24
2
Nested params and redirect_to
I have a simple client search screen that posts the following params: Parameters: {"search"=>"Search", "action"=>"list", "client_search"=>{"first_name"=>"jane", last_name"=>"smith"}, "controller"=>"client"} This works fine. However I want to redirect to the same
2006 Aug 07
3
wrong number of bind variables
I''m getting this error message since i moved alot of the database logic to the model. wrong number of bind variables (0 for 2) in: first_name = ? AND last_name = ? def self.authenticate(first_name, last_name, password) user = User.find(:first, :conditions => [''first_name = ? AND last_name = ?'']) if user.blank? Digest::SHA256.hexdigest(password +
2006 Feb 28
6
How To Validate Boolean Form Field
Hello all. I''ve got the following in my model: class Individual < ActiveRecord::Base validates_presence_of :first_name, :last_name, :street, :city, :state, :zip validates_acceptance_of :AZ_resident, :message => "You must be an Arizona resident." end The AZ_resident field is present and defined as boolean (PostgreSQL 8.1), but validation will not occur.
2008 Jul 06
1
ActionView::Base.field_error_proc not getting an error field
In my User form I have standard field to get user record attributes (first_name, last_name and email) I also have a select drop_down to choose a role from an array first_name, last_name and email are user record attributes, but I defined the role name as a virtual attribute validates_presence_of :email, :last_name attr_accessor :role_name validates_presence_of :role_name, :if =>
2006 Aug 07
2
Bind variables error
wrong number of bind variables (0 for 2) in: first_name = ? AND last_name = ? I''m not sure why I"m getting this error ? def self.authenticate(first_name, last_name, password) user = User.find(:first, :conditions => [''first_name = ? AND last_name = ?'']) if user.blank? Digest::SHA256.hexdigest(password + user.password_salt) != user.password_hash