Displaying 20 results from an estimated 21 matches for "category_name".
2006 Jan 08
2
sorting issue
I''ve got the following setup:
category (hm) <-> (bt) activity
An activity has an amount, date, location, note, and category. I''m
sorting my activities table by category_id (foreign key in activity),
but how do I sort it by category_name instead? Basically I just need
category_name in the result set. Here''s what I have now:
@all = Activity.find(:all, :order => ''category'')
How do I grab the category_name column from Category so that it is part
of @all?
Thanks!
--
Posted via http://www.ruby-forum...
2006 Apr 21
6
How access to the tables whitout a model
i have a table called Products whit a model product, but in the view i
need show the category od the product, but whitout a model of
categories...
--
Posted via http://www.ruby-forum.com/.
2006 Jul 28
11
Forum
Im making forum and i have problem with paths.
Here is code:
http://pastie.caboo.se/6389
With this code, it works. But its a bit weird to use so many paths
function. For every path i need to make new function. So can you suggest
me something.
Tables are like here:
http://wiki.rubyonrails.com/rails/pages/ForumExample
--
Posted via http://www.ruby-forum.com/.
2006 Jul 07
9
Search on data accross many tables, linked by belongs_to
I am using Ferret and acts_as_ferret, as my search back-end for my Rails
project. I have a question about using acts_as_ferret on a main table
that is linked to other tables by foreign keys. Is there a way to
include the information linked by the belongs_to keyword in the search
results ?
As an example, let''s say I have a main table ''posts'':
2005 Jul 22
1
A Bit Baffled By text_field
...oint I''ve lost perspective.
It''s probably something simple but I can''t see it anymore.
I have a component that looks like this:
<% for advertiser_category in @advertiser_categories %>
<li>
<%= text_field ''advertiser_category'', ''category_name'', :class => "category"
%><br/>
<%= link_to advertiser_category.category_name, {:action=> ''edit'', :id =>
advertiser_category}, "class" => "rec" %>
</li>
<% end %>
When this renders, the text fields are e...
2006 Feb 01
0
to_param() / url generation Question
I''m trying to implement the to_param method to allow url generation to
be in the format of /:category_name/:article_permalink (as discussed on
page 299 of Agile Web Development With Rails).
I expect that I need to override/implement the to_param method and have
it return the category_name for the category model and the
article_permalink for my article model, but I haven''t had any luck in
d...
2010 May 13
1
Routing - newbie question about shorting the url
Hi
Right now I have my url showing as the following:
http://localhost/categories/italian/recipes/special-pasta-sauce
I would like it to be:
http://localhost/categories/italian/special-pasta-sauce
(or even http://localhost/italian/special-pasta-sauce)
my category model has_many :recipes and my recipes model
belongs_to :category (for the purposes of my test project a recipe
can only belong to one
2006 May 11
3
Find By ID
Hi folks,
Newbie with ruby on rails but very excited by the features provided by
the framework ;)
Suppose I''ve got a table ''Company'' and a table ''Category'' Company
belongs to a category but I will retrieve the Catagory in the Company
list?
It seems that I don''t have the basic ruby wau of thinking to get this
easily.
Can someone help?
2006 Jun 19
10
Trying to delete from a unordered list using ajax
...ot;text/javascript"></script>
<form action="/home/add" method="post" onsubmit="new
Ajax.Request(''/home/add'', {asynchronous:true, evalScripts:true,
parameters:Form.serialize(this)}); return false;">
Category: <input id="category_name" name="category[name]" size="30"
type="text" />
<input name="commit" type="submit" value="Add" />
</form>
<ul id="categories">
<li id="a7">a7 [<span><a href="#&qu...
2007 Nov 09
2
Problem with stemming and AAF
...},
:care => { :boost => -2 },
:manufacturer_name => { :boost => 1,
:store => :yes },
:collection_name => { :boost => 1,
:store => :yes },
:category_name => { :boost => 0 }
},
:remote => true,
:analyzer => StemmedAnalyzer.new )
Straight forward, no errors. But also no results. Searching for chairs
returns only results for that word, not chair or chairs. I know the
actu...
2007 Aug 06
4
acts_as_ferret cross model index not updating
Does anyone know how do you get acts_as_ferret to automagically update
non-standard fields?
I''ve followed Rails Envy''s tutorial
(http://www.railsenvy.com/2007/2/19/acts-as-ferret-tutorial#nonmodel) to
get aaf working across different models. And once the index is built it
searches fine.
In my (main) model, I''ve put:
acts_as_ferret :fields => [ :name,
2006 Mar 12
11
HABTM selection conditions
Hi,
I am currently trying to learn RoR and there is something I cannot
figure out.
I have two models: Article and Category, that are HABTM-linked.
Everything works fine if I want to select all articles corresponding to
a category, with something like
@articles = @category.find(@params[:id]).articles
However, I have a ''published'' field in my ''articles''
2006 Jan 02
6
Paginate with joins messing with id
...URI:
@topic_pages, @topics = paginate :topics,
:joins => "INNER JOIN categories ON
topics.category_id = categories.id",
:conditions => ["topics.is_deleted !=
1 AND categories.safe_name = ?", params[:category_name]],
:order_by => "topics.is_sticky DESC,
topics.id DESC",
:per_page => 20
Then, on my topics listing page I try this:
for topic in @topics
link_to h(topic.title), :action => ''show'', :id => t...
2013 Nov 10
3
accepts_nested_attributes_for how, example
I have following tables with following models:
users(id, role_id) *has_many :entries*
categories(id, category_name) *has_many :entries*
entries(id, category_id, user_id) *belongs_to :user, belongs_to
:category, has_one :storage*
storages(id, title, content, entry_id)* belongs_to :entry*, *has_one
:vote*
votes(id, count, storage_id) *belongs_to :storage*
Now, when user create new entry(t...
2006 Aug 11
1
Avoiding adding duplicates to has_many collection?
Since there''s no ''exists?'' method for a has_many collection, is there an
easier way to avoid adding duplicates to a collection? (I assume
obj.items << item would add duplicates if repeatedly called.) Right now
I do:
category = Category.find_or_create_by_name(category_name)
directory.categories << [ category ] if
directory.categories.find(:first, :conditions=>[''category_id=?'',
category.id]).nil?
YUCK. Sure would be nice if there was a ''collection#exists?(id)'' or
''collection#exists?(obj)''.
Joe
--
P...
2006 Apr 09
1
select helper question
...Category",
:foreign_key=>"category_id"
end
And scaffolded the controller with the generator. I modified the
_form.rhtml for creating and updated to this:
<%= error_messages_for ''category'' %>
<!--[form:category]-->
<p><label for="category_name">Name</label><br/>
<%= text_field ''category'', ''name'' %></p>
<p>Abspeichern unter:<br/>
<%= select ''category'',''parent_category'', Category.find_all.collect {|p|
[p.name,p.id]} %>...
2007 Jul 30
0
Rails/MSSQL error
...n I try to save text with
japanese characters:
DBI::DatabaseError: Execute
OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server
Line 1: Incorrect syntax near ''20070730''.
HRESULT error code:0x80020009
Exception occurred.: INSERT INTO categories ([category_name],
[updated_at], [created_by], [updated_by], [description], [created_at])
VALUES(''費用区分'', ''20070730 13:57:25'', 1001, 1001, ''Expense '', ''20070730
13:57:25'')
I have done all of the thing needed that makes rails support for
unicode...
2006 Feb 07
0
scope problems testing a helper method that calls link_to()
..._helper.rb I''ve got a method called ''party_link()¨:
def party_link(party)
link_to party.full_name, { :controller => ''contacts'',
:action => ''view'',
:category => party.category_name,
:id => party.id },
:class => ''a2''
end
It takes a Party object (person, organization...) and returns an HTML link to
that party''s contact page. Simple enough. And it appears to work well enough
from the browser.
We...
2006 Jan 02
3
Selecting conditionally from HABTM
Hello,
I was wondering whether there is a nice Rubyesque way of selecting
from a pair of HABTM models where one of them is inherited from
another object.
Here is the situation:
I have a ''posts'' table from which ''replies'' and ''articles'' are
inherited. Articles have_and_belong_to_many categories, but neither
posts nor replies do (it just does
2018 Jan 03
4
DNS logging for TLD queries?
On 1/2/2018 2:50 AM, Denis Cardon wrote:
> Hi LingPanda101,
>
>
>> Is it possible to filter DNS queries for specific TLD's using the
>> internal logging system? My IPS/IDS alerts me when a suspicious TLD is
>> being queried. However I'm only able to see the DC as the source.
>> Thanks.
>>
>> Ubuntu 14.04 Samba 4.7.3.
>
> First you