Displaying 5 results from an estimated 5 matches for "book_pages".
2006 Aug 07
8
Syntax Problem
In an *.rhtml, why do I need to add <% for product in @products %> in
order that I may call an <img class="list-image" src="<%=
product.img_url %>"/>. Is there not another way to skip the "for
product" line? I really dont want to include it. I tried @products =
product but it does not work. Can anyone help shed light on this matter?
--
Posted via
2012 Feb 28
8
getting error:undefined method 'current'
hi all,
i am getting an error ''undefined method ''current'' for 852:Fixnum'', the
error coming for following line
<%if @expert_pagination.current.previous%>
<a href="#" class="darkgray1"
2006 Aug 14
5
Tutorial for Queries
Hi! I''m looking for a good tutorial that explains the main points of
performing queries with Rails. I do have AWDWR and have read the
section on ''find'' but I''m looking for something that goes into more
detail on how to perform queries across tables.
Abstracted from my current application, this is an example:
* person has_many sites
* site has_one room
*
2006 Apr 11
2
how to order by a related class???
...TOP 10 * FROM (
SELECT TOP 10 * FROM books ORDER BY title
) AS tmp1 ORDER BY title desc
) AS tmp2 ORDER BY title
see? no trace of the authors table, so it''s impossible to order by any
author''s column.
if I tell rails to include the authors table with something like
@book_pages, @books =
paginate :book,
:order => ''title'', :per_page => 10,
:include => [:author]
then rails generates the following
SELECT * FROM (
SELECT TOP 10 * FROM (
SELECT TOP 10
books.[id] AS t0_r0,
books.[title] as t0_r1,
authors.[id] as t...
2006 Dec 04
10
Avoiding SQL Injection in :order?
...gt; [ "user_name = ?", user_name]
Is there any such system for escaping injection in :order? It seems to
only take a string and feed it to the SQL statement. This causes a
vulnerability when using params to set :order as in this function:
def list
sort_by = params[:sort_by]
@book_pages, @books = paginate :books,
:order => sort_by,
:per_page => 10
end
We''ve tried a few methods to sanitize sort_by such as :order => [''?'',
sort_by] but it just passes that to the SQL statement...