Displaying 11 results from an estimated 11 matches similar to: "Help with DRY: too much code in my view"
2006 Feb 26
3
Rails Naming Conventions
DB field names:
If I have a table that references 2 or more separate users from my users
table, is there a recommended naming convention for this situation? In
my case, I have 3 users associated with a record in my projects table:
requester_user_id
created_by
updated_by
I could name one of them "user_id", and then projects.user would work I
guess, but wouldn''t work
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
2005 Dec 31
7
Dynamic form? Not really!
Hi guru''s out there,
Im happilly coding my first rails app, and all goes well. I find myself
manually coding in a particular field all the time (company_id), that relates
the contact to a company. The total coding of this form seems somewhat much.
Could somebody tell me what Rails power I''m possibly missing and stuborn as I
am trying to do myself?
I was wondering if the
2006 Jun 25
4
Zebra Striping a Collection of Partials
I''m using render to display a collection of partials, where each partial
is a table row. Is it possible to zebra-stripe the table using this
method i.e. alternate table rows get a different CSS class? I can''t work
out how each row partial would know whether it was odd or even.
In the normal scheme of things I could do:
<% odd_or_even = 0
for asset in @assets
2006 Jan 26
42
ruby script/generate scaffold Product Admin hangs
Hi
I am running Mac OX tiger with the installed ruby 1.8.2, and
mysql5 (I checked that it was running in preference). I
tried to run the various fixes recommended in agileweb. I am
stuck on page 57, script/generate scaffold...
> Could you paste in your database.yml file, from the
> "config" folder inside your Rails app? If you have any
> passwords entered there, you should
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''
2011 Dec 05
9
jquery - word is not defined
Just starting out with a beginner book on jquery and the very first thing I am trying fails (has to be me)
Rails 3.1 - other jquery things working including a poor example of drag & drop that is my ultimate target here but just simply trying to get every alternating row in a table to have a different css class
So I''m using...
app/assets/javascripts/people.js.coffee and put in...
2006 Mar 27
0
update subset of my data
Please can someone put me out of my misery...
I am missing the point here:
I have a table of albums called: dealers
I have a table of images: popp_images
each dealer has 6 popp_images linked by foriegn key: albumid
Each dealer can login using user_engine engine
I restrict viewing for each dealer to their own images by assigning each
dealer their own albumid.
I list their images with:
in my
2006 Feb 15
0
Confused by this error when trying to use ''pagination''
Trying to create stuff without resorting to scaffold command.
I have a list view in my login_controller.rb file...
def list_users
@user_pages, @users = paginate :users, :per_page => 14
end
I have a command in my list_users.rhtml file which undoubtedly calls
this pagination...
<%
odd_or_even = 0
for user in @users
odd_or_even = 1 - odd_or_even
%>
and instead of being presented a
2006 Mar 09
3
Need help PLEASE!!! - updating collection from form
Greetings!
I''m trying to update a set of records from the same model on one form. The AWD book gives an example on p.356 but I guess I''m not understanding it.
I can see from the error message I''m getting that the controller is receiving a hash of hashes back from the view, and that it''s got the stuff I expected (two values per record that was sent to the
2006 Feb 04
1
Can I reset the cycle helper?
Hi:
I have lines in a table I wish to stripe BUT, every now and then
there is another type of line, a section header line. I''d like to be
able to start the line after a section heading always as one of the
two classes the cycle helper is cycling between. Is it possible? If
so, how?
bruce
PS. I realise I could do this with ''odd_or_even'' or the %2 method
(mod