search for: post_id

Displaying 20 results from an estimated 75 matches for "post_id".

Did you mean: port_id
2007 May 31
Sample Merb App
I put together a sample app to help people learn Merb: I also blogged about it here: -- Zack Chandler
2006 Jun 08
Displaying Calculation on Index
Hi, I am trying to create a simple point system and display the total on my index page. So I have my db basically setup like this: Posts id, body, created_at, user_id Post_points id, post_id, user_id, created_at, value So as you can see I am allowing other users to create points on the post and my db will store who gave the point as well. "value" is the point value which can either be -1 or 1. Basically I just want to add these points together for a given post_id and di...
2006 Apr 08
trouble expiring cached pages
...ting my cached pages to expire. Maybe one of you guys can help me out. I''ll show my sweeper and then my log to show that it "should" be working. class PragmaticSweeper < ActionController::Caching::Sweeper observe Comment def after_save(comment) expire_page(comment.post_id) end private def expire_page(post_id) logger.error("I made it to the caching method in the SWEEPER!!!!!!") expire_action(:controller => ''pragmatic'', :action => ''view'', :id => post_i...
2006 Aug 03
Listing all of a nested Resources
I''ll use the example on the Rails blog. map.resources :posts do |posts| posts.resources :comments, :trackbacks end Now comments are at /posts/:post_id/comments. Okay but what if I want to list all the comments for all the posts. It should be at /comments, but that isn''t map that way. Can I map comments twice? -- Posted via
2009 Apr 15
Getting Started with Rails - post_comment_url the last section and just added the comments part. So while testing and looking over comments_controller.rb; I see the reference to post_comment_url calll where is this defined. Below is the message I am getting. Thanks ActionController::RoutingError (post_comment_url failed to generate from {:post_id=>#<Post id: 1, name: "lin", title: "post 1", content: "content 1", created_at: "2009-04-15 16:56:44", updated_at: "2009-04-15 16:56:44">, :action=>"show", :id=>#<Comment id: nil, commenter: "jake lin", body: &qu...
2009 Aug 16
any help with captcha in my comments ?
this is my error: Processing ApplicationController#create (for at 2009-08-17 00:57:56) [POST] Parameters: {"comment"=>{"name"=>"asdasd", "body"=>"asdasd"}, "commit"=>"Add Comment", "post_id"=>"19", "authenticity_token"=>"B5dll5fTaDO+ZrEs1S0KkYsmK8VMzCOeDEf731w21zY=", "captcha"=>"asdasd", "_"=>""} SyntaxError (/Users/webstic/Sites/weblog/app/controllers/comments_controlle...
2005 Mar 10
Some Basic Questions
Sorry I can''t access IRC from work so I hope you don''t mind me asking my newbie questions here: 1) I have the following code: @post = Post.find(@params[''id'']) @comments = Comment.find_all "post_id = #@params[''id'']", "created_on ASC" And I am have problems with the second line. I want to pass the id from my post to the comments line to get the comments for that post. What am I doing wrong? I tried a ton of different ways and they all don''t work 2...
2006 Jul 04
writing to many_to_many table
I have three tables. users, posts, users_posts. This last one is to mark a post as read. How do I write to the users_post table? Here''s what I have: In model ''User_Post'' belongs_to :post belongs_to :user In post/view/show: <%= link_to "Mark As Read", :controller => ''post'', :action => ''post_read'',
2006 Apr 20
Returning Count from find_by_sql
I want to return an int from a find_by_sql call. But when I use that result to compare to another count the error tells me I have an array. MODEL: # Returns the number of comments in a specified post def self.find_count(post_id) find_by_sql(["SELECT COUNT(*) FROM commments WHERE post_id = ?", post_id]) end CONTROLLER: def test @post = Post.find(@params["post_id"]) @comment = Comment.find_next(@params["post_id"], @params["position"])...
2007 Nov 12
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 Feb 24
too many components?
...#39;, :action=>''display_comments'', :id=> on comments/display_comments i iterate through the comments and then, display_comments.rhtml render_component(:controller=>''comments'', :action=>''new'', :id=>@id) (@id is the post_id) so this is all works okay, i can add the comment and i changed the redirect to posts/show/@id problem is, if the new comment form fails (say, i dont'' put in a required author field), it redirects to /comments/new/ to give me an error message when i really wnat tha...
2006 Oct 16
Rails AR/Oracle Unit Test: [5310] failed (but getting better)
...2) Failure: test_eager_with_has_many_through_join_model_with_conditions(EagerAssociationTest) [./test/associations/eager_test.rb:126]: <[#<SpecialComment:0x45f99b00 @attributes={"body"=>"Special type", "type"=>"SpecialComment", "post_id"=>4, "id"=>6}>, #<SpecialComment:0x45f9229c @attributes={"body"=>"Special type 2", "type"=>"SpecialComment", "post_id"=>4, "id"=>7}>, #<VerySpecialComment:0x45f8bca8 @attributes={"body&quot...
2012 Mar 12
how to design a api?
hi,everyone. now i start to design a api. the url like this http://localhost:3000/api?seckey=123&&post_id=1 the visitor need a seckey to access auth.and get info via json. so i dont think thats a good api. i need your answers.thx -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-...
2006 Jul 03
Check if row already exists?
I''m working on a system that has a series od "bids" associated with "posts". Vurrently when a bid is placed I have it creating a new row each time in the "bids" table. The bids table has id, post_id, and user_id. The logic is to check to see if a bid already exists with a given post_id and user_id. If it does, then just update the "amount" field. If it doesn''t, then create a new line. Here''s what I have to create the row: def @post = Post.find(params[:post...
2006 Jan 09
AR: Quoting in Join Model Test
...things are sometimes symptomatic of a larger, more fundamental problem with the way I''m handling things, I thought I should ask. For your convience, here is the test in question: def test_has_many_with_piggyback assert_equal "2", categories(:sti_test).authors.first.post_id end -Derrick Spell "Perl''s grammar can not be reduced to BNF. The work of parsing perl is distributed between yacc, the lexer, smoke and mirrors.'''' -Chaim Frenkel
2007 Jan 01
Simple question on inserting child data
...g I have finally sat down to create a simple app to dirve home a lor of the concepts to which have been read. So I figured a simple blog app is the best way to do it. The bad thing is that I am already hung up when creating replies to a blog posting. I can''t figure out how to insert the post_id value into the reply table. When creating a reply the user is directed to a page via a url simular to the following http://localhost:3000/main/reply/4, with the value 4 being the post_id that is being replied to. In the controller I have: class MainController < Application...
2009 Dec 03
Dynamic Paths
Hey there, I''m in the muck of a major rails project, and need a bit of advice. Google isn''t much help in this case, so I came here. I''m trying to set up a URL structure as follows: where the user has_many posts and the post belongs_to user. I''m using the friendly_id plugin to enable easy lookup with the user''s username, and I would like to have the blog paths automatically retrieved, instead of getting a path error (as such): ActionView::TemplateError (pos...
2006 Jul 22
Community request - can someone show me REST?
I mentioned this in another thread, but I''ve got a formal request now. After reading tons of stuff about REST, I don''t really get it. I need to see an example. I''d like someone to write up an example blog app with these requirements - RESTful using the simply_restful plugin (or edge rails) - allows posting of comments to articles - has categories for posts No need
2009 Apr 23
state of lfarkas KVM repository + Centos KVM wiki
Hi all, I have followed the wiki howto to install KVM on my C5 server with a F10 x86_64 guest. Howto here: With one small problem here: the guest is really running stable for one week now. Maybe someone could have a look at udev why it always sets permission for /dev/net/tun wrong and update the wiki? But my actual question is, what's the state of lfarkas repository? Can it be trusted? Sa...
2006 Jul 12
odd habtm behavior? or is it me?
...rams[''post''][''categories''] ) then a save is sucessful for both new and found Posts. 2) if a new Post has a category then save is successful but the categories are not associated with the created object, but this sql is logged: INSERT INTO categories_posts ("post_id", "id", "category_id") VALUES (0,1,1) - I have also tried: Post.create(@params[''post'']).category_ids = @params[''post''][''categories''] # without the prep above and with attr_protected :categories 3) if a Post created wit...