Displaying 20 results from an estimated 7000 matches similar to: "How to code partial search value in a find command"
2006 Aug 02
9
How to fetch the previous or next record
Hello,
Is there some built-in facility for fetching the Previous or Next record
from a table? Assume the command find_by_name has been issued, and the
variable @name contains the name "John Doe". I''m looking for something
like find_next(@name) and find_previous(@name). What''s a good way to
pursue if one has to roll their own methods?
Thanks for the help,
gk
--
2006 Jul 31
3
Missing controller default code
Hello,
I generated a controller, using the command:
ruby script/generate controller my_kontroller my_model
The generated controller file, however, contains an empty class
definition. The default controller code is missing.
Any idea what went wrong?
Thanks,
gk
--
Posted via http://www.ruby-forum.com/.
2006 Aug 06
6
View passing empty or no value to controller -- help
Hi,
I have the following view:
<%= start_form_tag ( { :action => ''find'' }, :method => ''get'') %>
<p>
<%= text_field_tag :lemma, params[:lemma] %>
</p>
<%= link_to "Find It", :class => "submit" %>
<%= end_form_tag %>
And the following find action in the controller:
2007 Sep 20
2
Rendering a partial from within that partial
I am having trouble rendering a partial called ''names'' through a submit
tag located within that partial. The form data is saving with my current
code. However, the existing data is not loading into the form and the
partial is not being re-rendered upon submission to reveal the changes
to this data.What might I do to fix this?
show.rhtml
<%= javascript_include_tag :defaults
2010 May 10
7
NilClass passed to partial view
Hi,
I have a simple program that tries to do something really basic.
First, I have a company Model :
-------------------------------------
class Company < ActiveRecord::Base
has_one :billingAddress, :foreign_key=>"id", :class_name=>"Address"
end
Then I have the address Model :
--------------------------------------
class Address< ActiveRecord::Base
belongs_to
2006 Jul 03
2
Still struggling with data flow ...
Hello,
The following view:
<%= start_form_tag %>
Enter term to find
<p>
<%= text_field_tag :name, params[:name] %>
</p>
<%= link_to "Find", { :action => ''find_term''} %>
<%= end_form_tag %>
does not appear to pass back the value of :name to the action:
def find_term
term =
2006 Aug 09
10
Next/ Previous record
Hi, Quick question (which means that I think there should be an easy
answer)...
When I am in the "show" view, I''d like to add 2 links, one for previous
and one for next record so that the user can go on to the next "result"
without having to go back to the ''list'' of results. However, I can''t
find my way about this problem :-S
2006 Jul 06
1
Problem implementing password and password confirmation
Hi,
I''m trying to implement password confirmation, based on the Agile
example, but just can''t make any progress.
User DB has these fields:
=========================
t.column :name, :string, :limit => 40
t.column :hashed_password, :string
t.column :salt, :string
User model has:
===============
attr_accessor :password_confirmation
2011 Apr 25
30
NoMethodError in Book
I got a following error.
NoMethodError in Book#new
Showing /home/amrit/boook/app/views/book/_form.html.erb where line #1
raised:
undefined method `model_name'' for NilClass:Class
The content of _form.html.erb file are:
<%= form_for(@post) do |f| %>
<% if @post.errors.any? %>
<div id="error_explanation">
<h2><%=
2006 Jul 06
3
Accessing form field contents
I have an HTML form on the screen, that is connected to a database
(standard Ruby way). I found that there are people that would rather not
fill in this information, but would rather search Amazon for the info.
Therefore, I added a link to the right of one of the fields that, when
pressed, will search Amazon for what ever you typed into that field.
So, how can I do that? At first I tried
2006 Feb 07
3
Newbie help ..
Hi ..
I am new to Rails and it is not clear to me why I am getting the
following error. Any help appreciated.
-m.
$cat app/views/admin/new.rhtml
<% @page_title = "New member..." -%>
<%= start_form_tag( :action => ''create'' ) %>
<table>
<tr>
<td> First Name: </td>
<td> <%= text_field(
2005 Feb 05
4
Creating collections
I''m trying to create a form where a collection is created, using the
example from the Rails 0.9.5 weblog posting:
http://weblog.rubyonrails.com/archives/2005/01/26/rails-095-a-world-of-
fixes-and-tweaks/
I''m having a bit of trouble. The controller currently looks like this:
class StudentController < ApplicationController
def new
render_text @params.inspect
2006 Aug 03
5
Rails - forms
Currently I have a registration form that is built like this:
<label for="First name">First name</label>
<%= text_field "user", "first_name" %><br>
<label for="Last name">Last name</label>
<%= text_field "user", "last_name" %><br>
<label for="Email">Email</label>
2006 Feb 03
9
Because I''m very slow - trying to use console
I can''t see how to use variables so I am using console to test things
out...
clients table - a column named first_name
My very brief console session...
>> clients = Client.find_by_sql("select * from clients where first_name
= FN")
ActiveRecord::StatementInvalid: RuntimeError: ERROR C42703 Mcolumn
"fn" does not exist Fparse_expr.c L1034
2007 Nov 06
2
Why is this view spec failing?
I can''t figure out why I am getting a failure. It renders out fine in
the browser.
<h1>New member</h1>
<%= error_messages_for :member %>
<% form_for(:member, :url => members_path) do |f| %>
<fieldset>
<legend>Member Info</legend>
<p><label for="member[first_name]">First Name:</label> <%=
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 = ?'' ,
2012 Apr 14
7
undefined method `model_name' for NilClass:Class
Hi guys,
I just started using Ruby on Rails. After implementing the RoR blog
tutorial I started with my own data model.
Sadly I am not able to get my create page running.
Model:
class Activity < ActiveRecord::Base
validates :activity, :presence => true
validates :forKids, :presence => true
validates :start_date, :presence => true
end
Controller:
class ActivitiesController <
2011 Aug 31
9
undefined method `model_name' for NilClass:Class in rails 3.0.0
Hi,
i got search which shows following error
ActionView::Template::Error (undefined method `model_name'' for
NilClass:Class):
1: <%= form_for(@employee) do |e| %>
2: EMP ID<%= e.text_field :id %><br>
3: <%= e.submit ''search'', :controller => ''employees'', :action =>
''search1'' %>
2006 Feb 02
12
basic ''find'' question
I am struggling to understand the methodology here...
I have a find.rhtml
<%= start_form_tag :action => ''list2'', :first_name = client %>
<%# render :partial => ''form'' %>
<p><label for="client_first_name">First name</label><br/>
<%= text_field ''client'', ''first_name''
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.