Displaying 20 results from an estimated 10000 matches similar to: "Problem with acts_as_commentable Plugin"
2006 Jul 17
1
acts_as_tree and :include
hello there,
i have a model that uses acts_as_tree:
>class GbEntry < ActiveRecord::Base
> acts_as_tree :order => ''created_at DESC''
>end
and i want it to paginate, including all children to avoid unnecessary
db queries:
> @gb_entry_pages, @gb_entries =
> paginate :gb_entries, :per_page => 15, :order => ''created_at DESC'',
2009 Feb 22
2
Mysql error unknown column 'columns.user_id'
Had this error when trying to add comments to another user''s photo.
ActiveRecord::StatementInvalid in User photosController#show
Mysql::Error: Unknown column ''comments.user_id'' in ''on clause'': SELECT
photos.`id` AS t0_r0, photos.`user_id` AS t0_r1, photos.`title` AS
t0_r2, photos.`body` AS t0_r3, photos.`created_at` AS t0....
I did create a user_id
2007 Feb 19
0
Invalid SQL generated with PostgreSQL 8.2.3
Hey,
Using Ruby 1.8.5, postgres-pr-0.4.0, activerecord-1.15.2, Rails 1.2.2
and PostgreSQL 8.2.3. I''m following the O''Reilly book "Ruby on
Rails", so you can tell I know precious little of what I''m doing ;-)
Well, I''ve created some models, and was working through examples, and
executed the following from a console:
>> show = Slideshow.find 1
2006 Jun 26
5
How can I dynamiclly generate models?
I am trying to write a plugin, ''acts_as_commentable'', for my models -
Image, Book, Music and so on, I do not want to use polymorphic
association, so very model should have its own comment class.
Here is my code
acts_as_commentable.rb
module Commentable
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def
2010 Oct 11
5
Object lost in memory/trashed?
Hi,
I''ve got a problem on which I''ve spent many hours, and I can''t get a
clue on what is happening... I hope someone here will be able to help
me.
Here is the situation : my Rails app uses acts_as_commentable and
acts_as_bookmarkable on a Diagram model. Everything''s working OK
individually: I can create a comment on a Diagram, bookmark it, and so
on.
Now,
2008 Aug 30
4
acts_as_commentable: find Post by date of comment
Hello,
I am using acts_as_commentable (related to Post) and I would like to
know how to get the list the posts ordered by date of comment (i.e.
post with recent comment first).
in addition if a post has no comment, i would it to be inserted based
on its creation date.
Thanks for your help
Nicolas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2006 May 15
33
acts_as_commentable release
I now have the acts_as_commentable plugin up on RubyForge. This
plugin will allow you to add comments to any active_record object in
your Rails application.
So far the directions are simple, and there are only a few features:
To install:
ruby script/plugin install
svn://rubyforge.org//var/svn/commentable/acts_as_commentable
In the readme there is a sample migration you will need to use, with
2006 Jul 11
1
Problems using the authorization plugin from Bill Katz
Hello everyone,
I was trying to set up access control in a new application Im working on,
I''m trying to use the excellent authorization plugin from Bill Katz,
Its pretty straight forward to setup and should be to use.
But when i try to give the same permission on two differents users on
the same object i get an error.
(Well , Im kinda new to all this rails stuff)
r = Red.find(1)
u1 =
2006 Dec 28
0
problem with assert_raise in Unit Test
I''m running a simple unit test to validate that ActiveRecord raises an
exception when I try and update a column with a duplicate foreign key.
Inside the unit test,
charge.time_logs << time_logs(:first)
will generate
ActiveRecord::StatementInvalid: Mysql::Error: #23000Duplicate entry
''20'' for key 2: UPDATE time_logs SET `task_id` = 1, `date_created` =
NULL,
2006 Aug 09
2
has_many through delete issue
I have the following many-to-many relationships defined in my model code
to model a many to many relationship between Media and PriceCode with
Price being the association table:
class Media < ActiveRecord::Base
has_many :prices
has_many :price_codes, :through => :prices
end
class Price < ActiveRecord::Base
belongs_to :media
belongs_to :price_code
end
class PriceCode <
2009 Dec 27
5
Difficulties in understanding Rail-Plugins in depth
Hi,
i try to understand how plugins work in detail.
Often you see stuff like:
class Post < ActiveRecord::Base
acts_as_commentable
end
I wonder what''s happen all there.
What kind of language-feature is behind this call "acts_as_commentable" ?
In my opinion you need some kind of extend or include to extend the
functionality of a model. And exactly this is which i found
2006 May 11
9
acts_as_commentable plugin
I''ve just about finished up work on a plugin similar to
acts_as_taggable, but for comments instead which would allow you to
attach comments (possibly even a threaded discussion if conbined with
acts_as_tree) to any object. Is there anyone that would be interested
in it? I don''t want to go throug the trouble of finding some way to
distribute it unless I know that there is a
2010 Apr 14
3
PGError: duplicate key
I''m running a rails 2.3.5 / ruby 1.8.7 / postgresql 8.4.2 app and have
just run into a curious problem.
I have several tables that are initialized with data from csv files
and I''ve noticed that, when I try to add new data to any of these
tables via Table.new I get a PGError on duplicate key.
For example:
MIGRATION:
class CreateNumbers < ActiveRecord::Migration
def self.up
2007 Oct 25
1
find - group - postgres
I am not sure that this is entirely a rails question as I am trying to
run the command in postgres and I am getting the same error...
controller code...
@client_slot_count = ClientSlotsDaily.find(:all,
:conditions => ["created_at > ? AND created_at < ? AND
facility_id = ? AND client_id IS NOT NULL",
starting_date, ending_date, @facility.id],
2013 Oct 17
0
Rails 4.0.1.rc1 has been released!
Hi everyone,
I am happy to announce that Rails 4.0.1.rc1 has been released. This is
a bug fix release and
includes more than 450 commits.
This release comes up with an important change on how Active Record
handles subsequent `order` calls.
In Rails 4.0.0 when you do something like this:
```ruby
User.order("name asc").order("created_at desc")
```
The later called `order`
2006 Apr 10
1
random | in join statement with more than one :include
I have an ActiveRecord class that has several has_many,belongs_to,
habtm, and the new has_many => :through relationships.
Whenever I try a
find(:all, :conditions => "some conds", :include [:relationship])
it works fine, but if I have
find(:all, :conditions => "some conds", :include [:relationship,
:other_relation])
it gets a sql error such as
Mysql::Error: You
2007 Nov 14
1
New Foxy Fixtures (Rails 2) & STI (Single Table Inheritance)
I''ve got some problems right now using the new model for relationships
in fixtures (by label, not by id) and STI. What I''ve got, is a couple
of models:
Attachment
--> FileDownload
Version
Version has_one file_download with file_download_id on the versions
table
In my fixtures, I have two FileDownloads in my attachments.yml like
so:
hemingway_alpha_zip:
size: 100
2010 Mar 01
3
remove apostrophe in query
Hi,
I want to generate a query with conditions like that
:conditions => ["score_team_1 ? score_team_2", compare_sign] .
The resulting query ends e.g. with score_team_1 ''='' score_team_2
How can i remove the apostrophes from include into the string?
Thanks
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2013 Mar 04
2
accepts_nested_attributes: undefined method 'association'_attributes
I have 2 models Timesheet and TimeEntry:
class Timesheet < ActiveRecord::Base
attr_accessible :status, :user_id, :time_entries_attributes
has_many :time_entries, dependent: :destroy
accepts_nested_attributes_for :time_entries, :reject_if => proc {
|attributes| attributes[''worktime''].blank? }
end
class TimeEntry < ActiveRecord::Base
attr_accessible :task_id,
2007 Feb 20
0
counter caching with acts_as_commentable
I find that my app is doing a lot of db queries to get comment counts
for various objects, as I reference these counts frequenly in my views.
This is using acts_as_commentable. Anyone have any tips for adding
counter caching to acts_as_commentable? I assume this is possible with
polymorphic associations?
Thanks!
--
Posted via http://www.ruby-forum.com/.