search for: posting

Displaying 20 results from an estimated 136084 matches for "posting".

2011 May 09
0
rails guides - getting started - section 10 security
The example doesn''t work as described for me; not sure if I haven''t followed it right, or there''s a problem with the code. Can someone help me to determine what the problem is. Specifically, after adding the authentication code to the PostsController, with this line: before_filter :authenticate, :except => [:index, :show] The guide says that "we want the user
2006 Jun 13
9
Find DB items by "title"
I''m having trouble finding then displaying all items in my "posts" table that match a certain search string. I have a from field: <%= start_form_tag :action=> "search" %> <div title="Search" id="searchform" class="form"> <h3>Search</h3> <%= error_messages_for ''post''
2006 Jan 22
11
ActiveRecord find
Suppose I have three tables - authors, posts and topics. Every post have a topic and every topic has an author, so I have posts.topic_id and topic.author_id. When the author is guest (not registered), author_id is nil. I need to find all the posts (in one query) where every post have all the information of the topic and the auther, so if p is one of those posts I could get the name of the
2006 Feb 14
1
Another HABTM Question
Hi there, I have a question on what would be the best way to save a HABTM model. A posting habtm categories, and a category habtm postings. class Category < ActiveRecord::Base has_and_belongs_to_many :postings end class Posting < ActiveRecord::Base has_and_belongs_to_many :categories end In my blog_controller, where the actual posting is saved, is where I think I''...
2006 Jul 04
8
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'', :user =>
2006 Apr 01
10
You have a nil object when you didn''t expect it!
Hi, I am creating a blog to learn ruby on rails. I have 2 different views/models/controllers, 1 called post and 1 called comments. How do i link a post from the views/post directory to the comments that belong to the post in the views/comment directory. This is the code in the post/show.rhtml <%= render :partial => "post", :object => @post %> <%= link_to
2008 Feb 29
4
App design question: user_photo helper
I''m having trouble using an application helper and understanding how I should make it work throughout my application - so if you can help me with this I''ll be overcoming a big hurdle in my learning. Here''s the helper method; [code=]# application_helper.rb def user_photo if @user.photo? return @user.photo.public_filename(:thumb) else return
2006 Apr 29
0
Trouble with firefox and AJAX
I''ve been creating my own message board in rails as a learning exercise. I''m currently trying to implement posting using AJAX, so the topic page as a whole doesn''t need reloading. What I''ve written works as epected in IE6 and Safari, but the AJAX call fails silently in Firefox 1.5 -- although the server has logged the request, the "success" callback event seems never to trigger, and...
2006 Feb 16
1
validations with associated object
Does anyone know if Rails is supposed to validate associated objects on creation? Say you have a User model, with has_many posts, and a Post model which belongs_to user. Further, the Post model has a validates_uniqueness_of :title. u = User.find(1) # this should pass u.posts.create :title => ''my new post title'' # this should fail u.posts.create :title => ''my
2006 Feb 05
2
render partial, object.property missing
trying to do my first rails app (surprise, it''s a blog!) anyhow. in list.rhtml, i have this: <% for post in @posts render(:partial => "post", :object=>post) end %> and in _post.rhtml, i have: <tr> <td><%= post.title%> <br /> <%= post.body%> <br /> problem is, no content shows up -- displays a
2006 Sep 18
3
Automatic reindexing of associated columns acts_as_taggable
Hi, So i''m trying to use acts_as_taggable with the acts_as_ferret plugin, where I have Post.rb model, which has a method tag_list made available through acts_as_taggable, as returns a string of associated tag words from the tags table (tag.rb). I''ve set up my Post.rb model in the following way. class Post < ActiveRecord::Base acts_as_taggable acts_as_ferret
2006 Jun 14
4
Using now() to determine what should be displayed
I''m trying to create a paginated list that will take note of the "end_date" field in my table. This is what I have: @post_pages, @posts = paginate(:posts, :per_page => 10, :order_by => ''end_date'') in the controller. And for the view: <h1>Posts ending soon</h1> <ul><% for post in @posts do %> <strong>Post Title:
2006 Jun 08
3
Foreign key confusion
I have 2 models right now: "users" and "posts". When a user creates a post I would like their id to be recorded under "user_id" in the "posts" table. Under the "user" model I have: class User < ActiveRecord::Base has_many :posts end And under the "posts" model I have: class Post < ActiveRecord::Base belongs_to :user
2006 Mar 22
2
Controller instance variables falling in and out of scope
Very bizarre behavior has cropped up in a few spots. # the action for viewing a blog post def posts @post = BlogPost.find_by_slug(params[:id], :include => :commentary) # a breakpoint here shows @post and @post.commentary with appropriate data redirect_to :action => ''archive'' unless @post end # posts.rhtml <%= @post.inspect %> => nil <%= render :partial
2007 Dec 14
3
Preview Message Before Saving?
Hi all, I''m sure this is really simple, but I can''t seem to figure it out. I want to let users preview their messages before submitting. Something in the form of: def new @post = Post.new end def preview #preview message text here #@post = Post.new(params[:post]) <--? end def create #save message on user''s confirmation ... @post.save end Have any
2011 Apr 30
8
"uninitialized constant PostsController::Post"
This time i read scaffold tutorial very carefully and finally try to generate a form without using the scaffold(just used a controller and view ).what i have done till now ,is as follow.Using rails 3.0.7. "rails generate controller posts index" 1) post_controller.rb class PostsController < ApplicationController def index @post=Post.new
2006 Feb 12
3
.empty? Method
I am using: if @post.empty? render_text "Post does not exist." end But it gives me this error: NoMethodError in Posts#view undefined method `empty?'' for #<Posts:0x39598d0> However, if the method list empty? apears and stuff so I am confused. -- Posted via http://www.ruby-forum.com/.
2005 Dec 23
2
has_many and belongs_to relationship error
Hi i am getting following error ActiveRecord::StatementInvalid in Blog#index Showing app/views/blog/index.rhtml where line #10 raised: Mysql::Error: #42S22Unknown column ''posts.user_id'' in ''where clause'': SELECT * FROM posts WHERE (posts.user_id = 4) Extracted source (around line #10): 7: <div class="separator">&nbsp;</div> 8:
2006 Jan 10
5
Select Tag and Associations
Hi there, I''ve been working on this for awhile and have finally decided to ask for a little guidance.I have a slight problem trying to save a selection. I have two models: A "Posting" has_many "Categories", and a "Category" belongs_to one "Posting". With that said, in the posting model I have "has_many :categories" and within the category model I have "belongs_to :posting". That part I ''believe'' is correct...
2012 Feb 07
6
nested route not receiving :id parameter within controller spec
I''ve got a share method in my controller, and I have the following spec: describe PostsController do describe "#share" do it "doesn''t blow up" do post :share, :id => @post.id end # ... etc And... It blows up! Failures: 1) PostsController#share shares Failure/Error: post :share