Displaying 20 results from an estimated 54 matches for "tag_nam".
Did you mean:
tag_name
2006 Feb 26
5
Help On Associations Extension.
...ongs_to_many
association so that i can do something like this on the location
model:
myLocation.tags.add_by_names ''tag1 tag2 tag3''
On the extension i want to do something like this:
class Location < ActiveRecord::Base
has_and_belongs_to_many :tags do
def add_by_names tag_names
tag_names.split(" ").each do |tag_name|
tag = Tag.find_by_name(tag_name) || Tag.create(:name => tag_name)
tags << tag unless tags.find(tag.id)
end
end
end
The problem is, that i cant feager out how to have access to location
tags collection insi...
2006 Apr 28
1
acts_as_taggable help
Ahoy, having a bit of difficulty w/ the acts as taggable GEM.
I was able to create a tagcloud, but now i want to filter items by tags.
in my controller i have
def show_tagged_with
<-- snip snip -->
@items = Item.find_tagged_with( :any => params[:tag_name])
@categories = Category.find_all
@tag_name = params[:tag_name]
@tagged_items = Item.tags_count(:limit => 100)
end
IN the VIEW
<% @items.each do |item| %>
<%= render :partial => ''list_stripes'', :locals => { :item => item } %>
<% end...
2006 Apr 17
6
acts_as_taggable confused
...ollection
photo.tag "wine beer alcohol"
# don''t need to split since it''s an array, but replaces the tags
collection
# trailing and leading spaces are properly removed
photo.tag [ ''wine '', '' vodka''], :clear => true
photo.tag_names # => [ ''wine'', ''vodka'' ]
# appends new tags with a different separator
# the ''wine'' tag won?t be duplicated
photo.tag_names << ''wine, beer, alcohol'', :separator => '',''
# The difference...
2006 Dec 26
0
acts_as_taggable Plugin issue (not gem)
...ng working in console, but not in controller. Any idea why?
This is the plugin not the gem of acts_as_taggable
*View*
<code>
<h1>Listing elements</h1>
<% if @elements.blank? %>
<p>There are currently no elements in the system tagged <%=
""#{params[:tag_name]}"" %>.</p>
<% else %>
<p>Currently tracking <%= @elements.size %> elements in the system
tagged <%= ""#{params[:tag_name]}"" %>.</p>
<table>
<tr>
</tr>
<%= render :partial => '...
2006 Dec 27
4
acts_as_taggable issue
This won''t post with a full code paste, so I''ve got to link it to
another forum where I''ve posted it.
http://www.railsweenie.com/forums/1/topics/1053
Can''t get the acts_as_taggable plugin to play nice. Works in console,
not in teh view.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
2012 Apr 18
1
has_and_belongs_to_many: Item Already in Collection?
...h.
create_table :contents_tags, :id => false do |t|
t.references :content
t.references :tag
end
When a user tries to add a new tag, I''m trying to detect if the
content already has the tag.
So ... I grab the tag like this:
tag = Tag.where("name = ?", tag_name)
Then I''m trying:
if !@content.tags.where(:id => "#{tag.id}").present?
but tag.id is always a huge number, like 2165404200
I only have two tags in the db right now, so the ID should be either 1
or 2
and i''ve verified those IDs in the db.
Any idea what'...
2006 Jan 19
5
limits of has_and_belongs_to_many
...rename all the primary id''s in the legacy database, or to
work around the fact that the primary id''s are not called ''id'' within
RoR instead.
I''ve been successful in using a join table with two fields named
''recipe_id'' and ''tag_name'' to relate a table called Recipes with a table
called Taggs, using this model:
class Recipe < ActiveRecord::Base
has_and_belongs_to_many :taggs, :join_table => "recipes_tagnames" ,
:association_foreign_key => "tag_name"
end
In this case both Recipes and T...
2006 Feb 28
0
acts_as_taggable vulnerable to attacks ?
Hi all !
I''d like to confirm if I''m reading correctly.
It seems ActiveRecord::Acts::Taggable::SingletonMethods#find_tagged_with
is vulnerable to SQL injection attacks:
def find_tagged_with(options = {})
options = { :separator => '' '' }.merge(options)
tag_names = ActiveRecord::Acts::Taggable.split_tag_names(options[:any]
|| options[:all], options[:separator])
raise "No tags were passed to :any or :all options" if tag_names.empty?
o, o_pk, o_fk, t, t_pk, t_fk, jt = set_locals_for_sql
sql = "SELECT #{o}.* FROM #{jt}, #{o}, #{t} WHERE...
2006 Feb 28
2
acts_as_taggable and auto_complete
I''m using the acts_as_taggable gem (who''s site has gone AWOL
apparently) and I''m wanting to make it autocomplete. I, however, am
the absolute worst JavaScript person ever, so is there anyone out
there that can point me to a tutorial or give some good starting
points? Thanks!
Kenneth
--
=> the blog from beyond <=
=> www.eyeheartzombies.com <=
2005 Dec 16
1
acts_as_taggable sql injection vulnerability
...notified Obie of this over a month ago, so hopefully he''s fixed it.
How to tell lif you''re vulnerable
======================
Make a tag with a single quote in it. See if raises an error.
Now, go delete your entire database.
How to fix
========
add/change the last line of split_tag_names
tag_names = tag_names.flatten.map { |name|
ActiveRecord::Base.connection.quote_string(tag.name.strip) }
}.uniq.compact
-- Remember to restart your app.
court3nay
http://caboo.se :: we like big fonts and yellow highlighting
http://habtm.com :: personal codelog
http://placelist.com :: just li...
2006 Jun 21
7
acts_as_taggable and paginate?
...regular way of paginating over
a collection doesn''t seem to work with acts_as_taggable. Here''s what my
method looks like that takes in a tag name, finds all the members that share
the tag and then displays all the members. Nothing too fancy at the
moment...
def show_all_tags
tag_name = params[:id]
@tagged_members = Tag.find_by_name(tag_name).tagged
end
Doing the standard: @tagged_member_pages, @tagged_members = paginate
:member, :per_page => 12 displays ALL the members in the DB.
Has anyone conquered such an issue like this?
Thank you,
Dave Hoefler
--------------...
2006 Feb 13
0
count_as_taggable distinctly
I needed to count tagged records, I came up with this:
<pre>def count_tagged_with(options = {})
options = { :separator => '' '' }.merge(options)
tag_names =
ActiveRecord::Acts::Taggable.split_tag_names(options[:any] ||
options[:all], options[:separator])
raise "No tags were passed to :any or :all options" if
tag_names.empty?
o, o_pk, o_fk, t, t_pk, t_fk, jt = set_locals_for_sql
sql = "SELECT COUNT(DI...
2007 Nov 29
0
has_many_polymorphs for user owned tags
...ndex in the generated migration, and added user_id to
the taggings table.
Then I added belongs_to :user in the Tagging model.
In the lib/tagging_extensions.rb file I added a new function:
def _add_tags_from_user incoming, user
taggable?(true)
tag_cast_to_string(incoming).each do |tag_name|
begin
tag = Tag.find_or_create_by_name(tag_name)
raise Tag::Error, "tag could not be saved: #{tag_name}" if
tag.new_record?
Tagging.create(:tag => tag, :taggable => self, :user_id =>
user.id)
rescue ActiveRecord::StatementInvalid =&...
2006 Jul 24
2
InPlaceSelectEditor question
I''m attempting to use the example given in the Rails Recipes book chapter 2,
to create a select drop-down using the InPlaceEditor function (modified to
be InPlaceSelectEditor.
The example given works (a country list drop-down), but I''m attempting to
use it to display a list of items generated from an object in another table
that is linked to the table that I''m editing.
2006 Jul 14
5
Acts_As_Taggable Plugin multiple controllers.
I have Acts_As_Taggable Plugin working. I have a HR controller and a
sales controller.
I have a document in hr tagged whitepaper and a differnent document in
sales tagged whitepaper
when I am in hr I see the hr document tagged with whitepaper and not
the sale document (what I want). but if I click on the tag whitepaper
I return two documents, hr and sales. I just want to return the hr
document
2009 Sep 22
1
new git hook to be installed
We've all wanted to be able to tweak a few server-side settings,
without having to find/ask/wait for someone do something manually
on the server. With this change to ovirt's "update" hook,
you can now do just that by pushing a specially formed tag to
the remote repository. (once this hook is installed) If that tag meets
several criteria, the "update" hook will run the
2015 Jun 15
2
git daemon on zytor is back in action
On 06/15/2015 12:50 PM, Ady wrote:
>
> Oops. Sorry, the other way around.
>
> If I understand correctly
>
> /tag/?id=/refs/tags/syslinux-4.07
>
> refers to the name of the tag, "syslinux-4.07"
>
> whereas:
>
> /tag/?id=a4fcb6d867aadcaf5af8f87eb1ba96abe2748159
>
> would be the corresponding reference to the hash. The
2006 Jul 31
1
How to get result of following SQL Query in Ruby?
Hi,
I have 2 tables as follows:-
_________________ ________________ ____________
taggings | |stores | | tags |
-----------------| |---------------| |------------|
--tag_id | |--store_id | |tag_id |
--store_id | |--store_name | |tag_name |
--user_id | |---------------| |------------|
-----------------|
Now I want to execute followin sql query on above tables:-
"select name from tags where tag_id in (select tag_id from taggings
where store_id in (select store_id from stores where citylist like
''%1%'...
2006 May 12
2
Problem regarding accessing attributes from object...
...----
[#"3"}>]
-----------
Now in aboove output the number between double quotes (3) which is of my
interest & I want to display it. How to do that?
Actually this is my method:-
====================================
class Tagging < ActiveRecord::Base
def self.find_count_of_tag(tag_name)
find_by_sql([
"SELECT count(*) as cntnew FROM taggings " +
"WHERE taggings.tag_id = (SELECT tags.id from tags where
tags.name=
''food'')"
])
end
end
====================================
Now this is code in...
2010 Oct 14
1
Cucumber Selenium web step to verify value of input field
...r_gate" field should contain "5"
From web_steps.rb
Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should contain
"([^\"]*)"$/ do |field, selector, value|
with_scope(selector) do
field = find_field(field)
field_value = (field.tag_name == ''textarea'') ? field.text : field.value
if field_value.respond_to? :should
field_value.should =~ /#{value}/
else
assert_match(/#{value}/, field_value)
end
end
end
--
You received this message because you are subscribed to the Google Groups "Ruby...