similar to: best practices for simple query

Displaying 20 results from an estimated 6000 matches similar to: "best practices for simple query"

2006 Feb 27
3
form questions
I have a very simple form that looks allows an input for an error code and then give the show page from the scaffolding if the error code is in the database and a notification on the list page, again from the scaffolding if not. Here''s the form: find.rhtml <h1>Find error</h1> <%= start_form_tag :action => ''search''%> <p><label
2006 May 18
2
attempt to override the ''tag'' method
I want to override the ''tag'' method in ActionView::Helpers::TagHelper to do some generalized error handling similar to the way scaffolding puts a red border around fields that fail validation. I''ve created a file lib/rails_patches/tag_helper.rb which contains the following. module ActionView module Helpers module TagHelper alias_method :orig_tag, :tag
2006 Apr 26
7
Not updating
I copied the scaffolding edit and update and made it like this, Note: awnser is edit. Admin_contoller.rb def awnser @question = Question.find(params[:id]) end def update @question = Question.find(params[:id]) if @question.update_attributes(params[:question]) flash[:notice] = ''Question was successfully updated.'' redirect_to :action => ''list''
2006 Jul 13
0
best practice on making a searchable/filterable list?
Hi, I have many pages that list information (modified from the scaffolding). I would like to include a box at the top of these pages that has some search criteria with drop downs, date ranges, etc. When the user submits, the controller then adds appropriate conditions to the find method, and the matching records are displayed with the search form maintaining the users selections. I have been
2007 Dec 03
5
spec for model_id should eql
Hello, I''m confused why the spec described below is failing. Other simple comparison specs are passing fine for the same model. The code is working accordingly when I test it through the console, I''m just having difficulty getting this spec to work. Any pointers would be appreciated. Failure message: ''Address fetch and geocode should extract department and write to
2006 Jan 03
1
options_from_collection_for_select - NIL Object
i am kind of desparated i try with options_from_collection_for_select to get option values, but it says You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.inject but @customers is not empty -> def get_customer @customers=Customer.find_all end i have tested it and also the attributes "id"
2006 Jul 25
1
newbie--how do i load a parsed file?
Hello there, I''m new with ruby on rails and i don''t know how to load up a parsed file into my database. I have my ruby script that parses it but don''t know where to put my code, or how to combine it with view/model/controller. this is what i have: class Description < ActiveRecord::Base def import_strings(a_file) table = { }
2006 Jul 24
2
Newbie error message!
hello you all, I''m new with Ruby on Rails. I''m developing an application. I got the follwoign erro, can anybody give a hand? ArgumentError in AdminController#import_strings wrong number of arguments (0 for 1) RAILS_ROOT: ./script/../config/.. Request Parameters: {"commit"=>"Import",
2006 Aug 12
0
How do I pass query from from to the controller?
Hi I need to pass a query string for a search to a controller from the view. View: <%= start_form_tag(:action => ''get_results'') %> <%= text_field ''search'', ''search_term'' %> <%= submit_tag "Search" %> <%= end_form_tag %> Controller: def get_results(query)
2006 Jul 21
1
Newbie Question about Ruby on rails---cant upload data
Hi everybody, Ruby on Rails is my first programming lenguage...it looks to me like i''m missing the big picture. I''m trying to upload a file into a database. In my app. my user needs to select a file and upload it...however I only want him to upload certain information from that file. I have written code to parse only string tables from that file. For example, the table
2006 Mar 17
1
How to update values in database in this form?
Hi, This is my rHtml page & Corresponding actions & model pages:- ===listform.rHtml================= <h1>Products List</h1> <%= start_form_tag(:action => "add_to_cart")%> <table> <tr> <% i=0 %> <th> Product No. </th> <th> Unit Price </th> <th> Available Qty. </th> <th> Demand Qty. </th>
2006 Mar 01
1
observe_field question
I''m sure this is a simple problem, but I''ve been working on it for a couple days and can''t seem to figure out the correct way to structure my observe_field call. The HTML and Javascript generated all appear correct, but the AJAX call is never made. Below is the code I''m using and any help would be much appreciated. models_controller.rb def
2006 Aug 02
3
using migration--newbie
Hi all, (I''m new with RoR) I''m using a migratio to import data into a database but nothing is being happens. I''m importing strings from a parsed file. this is what I have: controller: class UploadController < ApplicationController def create table = { } params[:localized_string][:data].each_line do |line| if line =~ /^\s* " (.*?) "
2006 Jul 06
1
Form not inserting data into database
I have a form to register a user. The issue I am having is the fact that it only populates login, hashed_password and created_at fields. DB table: create table users ( id int not null auto_increment, login varchar(100) default null, hashed_password char(40) default null, email varchar(255) default null, salt varchar(255) default
2006 Jul 20
1
Ajax and observe_field not updating specified DIV
I have a page that has a dropdown which i''m using observe_field on to make an ajax call back to my controller. The page initially displays fine. The method is invoked in my controller when i select a choice in the dropdown and I have an rjs file which is then invoked. The rjs file looks like this: page.replace_html ''embed_calendar'', :partial =>
2006 Jul 28
0
newbie----what''s wrong with my code
I know i''m new with ruby and i''ve been kind of confused with how rails manages all the details. I want to store the key-values in different columns on my database so that when I enter a eky, it gies me the corresponding value. this is what i have: my view: <h1>Importing Strings<h1> <%=error_messages_for("string_record")%> <%=
2006 Mar 29
1
Help: Input of form 1 to hidden field in form 2?
Hi all I''m new to rails an i''m trying to build a step by step form / process to gather data. For example: form one: User enters a 8 digit number the submit button points to form 2. form two: the 8 digit number from form one becomes a hidden field in form 2. The problem I have is that the entire hash from form 1 is showing up in form two rather than just the input data.
2006 Dec 07
6
form_tag not producing output
I''ve got two servers, both with Rails 1.1.6 on them. I''m trying to remove some of the newly-deprecated stuff in my app, and I''ve run into a problem. My login page used to look like this: <div title="Account login" id="loginform" class="form"> <h1>Please Sign In</h1> <%= start_form_tag :action =>
2005 Dec 17
0
Passing multiple parameters with select-option to controller
Hi all, I''m using Windows Xp, Mysql 5, Webrick, Rails 1.0 I''ve 3 tables which have HABTM relationship. My tables names are all set to uncountble. Name of tabels are anabilimdali (includes department info id name etc.), ogretimuye (personel information like id , name , dept. ) yayin (document information), and for relationships yayin_anabilimdali , yayin_ogretimuye . The
2006 Mar 05
2
AJAX call chain and DRY questions
Hey I have a page with a drop list. When the user selects an option in the drop I call an action in the controller with ajax. Now, in the controller, I gather some data from the db, but how do I present these data in a nice way? I really need to make use of the html helpers, but these clearly are not available in the controller. How do I output the array that I have gathered? My view page