Displaying 20 results from an estimated 136880 matches for "posted".
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"
...ich I think is assigning the @post variable with the results. But how
exactly can I get them to display? I made a dummy action in the
post_contoller.rb called "show_search" and a view called
"show_search.rhtml" what''s the last step to get the results to display?
--
Posted via http://www.ruby-forum.com/.
2006 Jan 22
11
ActiveRecord find
...information of the topic and the auther, so if p is one of those
posts I could get the name of the author like this:
name = p.topic.author.name
If the author is a guest, then name should be "Guest" (or nil if it''s
more simple).
How do I do that with ActiveRecord find ?
--
Posted via http://www.ruby-forum.com/.
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''m
2006 Jul 04
8
writing to many_to_many table
...quot;, :controller => ''post'', :action =>
''post_read'',
:user => @user.id :post => @post.id %>
In post_controller:
def post_read
@postread = UserPost.new(params[:user :post])
if @postread.save
flash[:notice] = "Read"
end
--
Posted via http://www.ruby-forum.com/.
2006 Apr 01
10
You have a nil object when you didn''t expect it!
...; <%= link_to comment.body, :action => ''show'', :id =>
comment.post_id %></h2>
</div>
I keep getting the "You have a nil object when you didn''t expect it!"
error message. I have tried everything i can think off.
Can anyone help?
--
Posted via http://www.ruby-forum.com/.
2008 Feb 29
4
App design question: user_photo helper
...se
lines...
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @posts }
format.rss { render :rss => @posts }
end
end[/code]
Or can I do this in a different way which doesn''t involve defining @user
in every controller action ?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To un...
2006 Apr 29
0
Trouble with firefox and AJAX
...osition=>''bottom'',
:url=>{ :action=>''post_edit'', :topic=>@topic } %>
==== _post.rhtml ====
<div class=''post'' id=''post_<%= post.id %>''>
<span class=''date''><%= post.posted_time %></span>
<span class=''title''><%= post.title %></span>
<span class=''post_text''><%= post.post %></span>
</div>
</div>
==== _post_form.rhtml ====
<% post = post_form %>
<di...
2006 Feb 16
1
validations with associated object
...dates_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 new post title''
The line that should fail is actually passing, giving a u.posts.size ==
2.
--
Posted via http://www.ruby-forum.com/.
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
...way to set ferret to automatically rebuild the tag index when a
Post is saved? I imagine it probably shouldn''t rebuild the entire index
for all posts every time a post is saved, as that might slow things up
eventually, right? So what would be a good solution..?
Thanks,
-Sidney
--
Posted via http://www.ruby-forum.com/.
2006 Jun 14
4
Using now() to determine what should be displayed
...;, :id => post %></br>
</br>
<% end %></ul>
Everything works great. But, I would like anything with an "end_date"
before today to not be displayed. I''m assuming I need to weasel now() in
there someplace, but I can''t figure out where.
--
Posted via http://www.ruby-forum.com/.
2006 Jun 08
3
Foreign key confusion
...s_to :user
end
When I create a post everything goes fine, but the "user_id" field in
"posts" is left at 0. I know I''m missing something, but I can''t seem to
translate all the documentation out there into my scenario. Any help
would be MUCH appreciated.
--
Posted via http://www.ruby-forum.com/.
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?
...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 ideas for this noob?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To un...
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
...arator"> </div>
<% end %>
<% for post in @posts %>
<div class="mission">
<h3><%= h(post.posttitle) %></h3>
<%= post.posttext %>
</div>
<div class="separator"> </div>
<% end %>
--
Posted via http://www.ruby-forum.com/.
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
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