Displaying 4 results from an estimated 4 matches for "publisher_id".
2006 Jun 09
1
finder_sql issue with has_many :through
...oblem is, when I try to call the
method, I get the following:
private method `gsub'' called for #<Array:0x267de04>
Here is my has_many code:
has_many :mod_privileges,
:finder_sql => [''SELECT assignments.* FROM assignments INNER
JOIN permissions ON assignments.publisher_id = permissions.publisher_id
WHERE permissions.user_id = #{current_user.id} AND (permissions.role_id
= 3 OR (permissions.role_id = 4 and permissions.assignment_id =
assignments.id))'']
and a simple test bit I threw into the view:
<%= debug(current_user.mod_privileges) %>
I was us...
2006 Jan 23
2
problem with options_for_select
...e database. In order to so so I
am passing it the @book.publishers array, but I suppose I am missing
something. The docs say that the selected element may be an array of
values, but I can''t get it to work. Any ideas? My code is below.
Thanks in advance.
Sean
<select name="publisher_ids[]">
<%= options_for_select (@publishers.map {|p| [truncate
(p.publisher_name, length = 30, truncate_string = "..."), p.id]},
@book.publishers )%>
</select>
2005 Jun 13
3
validations not working with collection population droplists
...html where line #16 raised:
undefined method `inject'' for nil:NilClass
Extracted source (around line #16):
13: <tr>
14: <td class="menutitle">Who published it?:</td>
15: <td>
16: <%= collection_select ''review'', ''publisher_id'',
@publishers, ''id'', ''name'' %>
17: <%= link_to ''Add'', :controller => ''publishers'',
:action => ''new'' %>
18: </td>
19: </tr>
Trace of template inclu...
2005 Mar 08
19
find_by_sql ON STEROID possible?
...reaks the inheritance...
there is a sql request that can fetch all that information at once:
SELECT b.*,
p.*,
a.*,
u.*
FROM books b,
publishers p,
authors a,
authors_books ab,
universities u
WHERE b.publisher_id = p.id and
a.id = ab.author_id and
b.id = ab.book_id and
a.university_id = u.id
that fetch every association in the (publisher book author university) db model
active record is based on NAMING CONVENTIONS so why can''t we do that?
(no matter if it'...