Displaying 14 results from an estimated 14 matches for "comment_id".
2009 Feb 20
6
How to mock an object defined in the before_filter function?
...comment, :only => [:destroy]
def destroy
@destroy_id = @comment.id #to be used in rendering partial
@comment.destroy
respond_to do |format|
format.js
end
end
def find_comment
@comment = Comment.find(:first, :conditions => [''id= ?'',params
[:comment_id]])
end
===============spec_file
spec code
describe CommentsController, "while deleting a comment" do
it "should render destroy.rjs in case of success" do
@comment = mock_model(Comment)
@comment.stub!(:id).and_return(1)
@comment.stub!(:destroy).and_return(:true)...
2007 Nov 12
7
schema_info always wants to be 3, even when set to 7
Hi all,
I''m having a very odd problem with db:migrate. I''m using Rails 1.2.5
on Windows XP SP2 and Ruby 1.8.6
I have seven migrations. If I run them with an empty database, it
runs the first three, then halts. When I look in schema_info, the
version is 3.
If I run db:migrate VERSION=7, then it runs through the remaining 4
migrations, and the version is 7 in the DB.
2006 Jun 03
6
Calculating row COUNTs
hi everyone,
I''m trying to do a simple calculation in my rails project. I would like
to find all rows in a table that match the given id of another table
(ie. comment_id) and has the value = 1 ("value" is a field in the
table), then add those values up. Next find the same rows with the
value = -1 and add those values up also. Finally, I would like to find
the total. Therefore, if there were 5 rows with value = 1, this would
be 5 and 3 rows with val...
2006 Jan 10
5
Select Tag and Associations
...ve "belongs_to
:posting". That part I ''believe'' is correct, however I very well could
be off on that.
The columns in the postings table:
+-------------------
| Field
+------------------
| id
| title
| body
| user_id
| category_id
| posting_status_id
| posting_image_id
| comment_id
| created_at
| updated_at
+-------------------
The columns in the categories table:
+-------------
| Field
+-------------
| id
| title
| description
+-------------
With the following code I can successfully display the categories in
the drop down, but the ID is not saved to the postings table.
&...
2006 Nov 23
0
Two repeatable crash bugs in Ferret proper
...x.search( %Q!file_name:"yo la"! )
--- Second bug: long tokens (?)
#!/usr/bin/ruby
require ''rubygems''
require ''ferret''
# Strangely, the omit_norms is required to exercise the bug.
field_infos = Ferret::Index::FieldInfos.new()
field_infos.add_field( :comment_id )
field_infos.add_field( :comment_body )
index = Ferret::Index::Index.new(
:field_infos => field_infos,
:path =>''./exercisequotebugindex'',
:create => true )
index << { :comment_id => 1, :comment_body => "weird URL, huh? [a hr...
2007 Jun 03
3
Contextual Associations
No doubt this has been covered but I''ll be damned if I can find it.
References appreciated so I can add to my library.
1. I have 3 tables in my problem: changes, environments, comments
2. changes are many-to-many to environments
3. changes has-many comments
Here''s the tricky part:
4. environments has-many comments dependent on the current
environment.
Tables:
changes,
2012 Jan 05
3
composite keys and association
...#39; and
require ''composite_primary_keys'' on which file ).
I can do the CRUD operation for post,then i want to create comment form,
in the _form.html.erb, the code likes below:
<%= form_for([@post, @post.comments.build]) do |f| %>
then i got an error,"unknown attribute: comment_id",
i think the build method need the parameter id which is default, but i
dont have this column,and i cant change any thing in the database,how to
resolve this problem?Thanks .
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Gr...
2019 Oct 02
2
CentOS 8 Broken Installation
...IT mode; the disks are not set into
RAID with the card, so only the mpt3sas DUD is required.
If you have a IR mode (RAID via the controller) configuration, you may
need the megaraid-sas DUD too.
Original post with solution:
https://www.facebook.com/groups/centosproject/permalink/10157729112557728/?comment_id=10157729981242728
> --
> Jonathan Billings <billings at negate.org>
>
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>
--
Ljubomir Ljubojevic
(Love is in th...
2009 Oct 05
1
Re: creating 2 things at the same time?
Hi Mike Chai
What I understood is you have relations like
comment has_one picture
picture belongs_to comment
As an example
comment name:string
picture name:string,comment_id:integer
So do as below
in comments_controller new action
@comment = Comment.new
@comment.picture = Picture.new
Now in view/comments/new.html.erb
<% form_for(@comment) do |f| %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
&...
2006 Apr 20
5
Integrating with Legacy Databases
...''Recipe 16 Integrating with
Legacy Databases'' (Rails Recipes, from PragProg, by Fowler) they deal
with integration with a WordPress db where all field names are
preceded by "comment_" -- i.e. comment_author_email.
The recipe explains how to deal with the primary key (comment_id) via:
ActiveRecord::Base.primary_key_prefix_type = :table_name_with_underscore
which is great: the primary key would obviously be the most important
piece to get working :)
However, it stops short of going into detail on dealing with this on
the other column names.
I guess what I''m look...
2010 Jan 27
2
has_many, through with nested models?
First the data model:
class Forum < ActiveRecord::Base
has_many :topics, :dependent => :destroy, :order => ''created_at
desc''
end
class User < ActiveRecord::Base
has_many :topics, :dependent => :destroy
has_many :comments, :dependent => :destroy
has_many :replies, :dependent => :destroy
end
class Topic < ActiveRecord::Base
belongs_to
2019 Oct 02
3
CentOS 8 Broken Installation
On 10/2/19 9:27 PM, Jonathan Billings wrote:
> On Oct 2, 2019, at 15:14, G?nther J. Niederwimmer <gjn at gjn.priv.at> wrote:
>>
>> Hello,
>>
>> Is it a Plan to correct the Broken mdadm and or driver for Intel Chipset C602,
>> my Server SuperMicro Board X9SRi-F have a Problem with the new C8 or RH8 ?
>
> Is there a bug filed on
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
2009 Mar 11
12
Eager loading comments associated with user submissions.
Hey everyone,
I am working on an application that allows users to submit articles,
and also comment on those articles. Pretty much exactly like Digg.
Everything works fine except that when there are a lot of comments
there are a lot of database queries to both fetch the comments and the
users who posted those comments. I have used eager loading in other
parts of my application to reduce the