Displaying 12 results from an estimated 12 matches for "post_control".
Did you mean:
boost_control
2006 Jul 14
0
acts_as_nested_set and acts_as_threaded
I''m trying to use acts_as_nested_set, as modifed by Bob Silva to add
threaded functionality. I''m getting the following error:
undefined method `display_threads'' for #<PostController:0x3ae9828>
...
#{RAILS_ROOT}/app/controllers/post_controller.rb:18:in `list''
Line 18 in post_controller.rb shows:
[post_controller.rb]
def list
display_threads @posts <= line 18
@post_pages, @posts = paginate :posts, :per_page => 10, :order =>
"root_id desc, lft"
end
The display_threads method is defined i...
2006 Jun 13
9
Find DB items by "title"
...lt;%= error_messages_for ''post'' %><br/>
<input type=text name="title">
<input type="submit" value="Search »" class="primary" />
<%= end_form_tag %>
That points to this action in my "post_controller.rb"
def search
@post = Post.find_all_by_title(params[:title])
end
Which 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_se...
2012 Apr 10
6
User Association
Please Im trying to create an application where i can post like twitter,
but i was the users name to be posted under their respective posts
My Post_controller looks like this
def index
@posts = Post.all(:order => "created_at DESC")
@users = User.find(:all)
#@user_id = current_user.find(params[:id])
respond_to do |format|
format.html
end
end
def create
@post = current_user.posts.create(:message => par...
2006 Apr 22
3
rjs woes, any hints?
...ascript to
the browser, but it doesn''t update the div I''ve specified. What appears to
be coming back from the controller is:
Element.update("my_form", "hello, rjs");
I''m tearing my hair out. Here''s the code (any help is much appreciated):
--post_controller.rb--
def new
end
--new.rjs--
page.replace_html ''my_form'', ''hello, rjs''
--list.rhtml--
<p><%= link_to_remote(''+'', :url => {:action => ''new''}) %></p>
<div id="my_form"><!-- x --&g...
2006 Dec 10
5
model-controller-paradigm: What about admin controllers?
Hi all
We all know the model-controller-paradigm: I have a model "News" which
has a corresponding CRUD-controller "NewsController".
But now I''m quite unsure about the following...
Guess we have normal visitors that visit our site www.??.com/news and we
have administrators that create and modify news items.
The admin should see an "Edit" link and a
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
end
def create
@post = Post.new(params[:post])
respond_to do |format|
end
end
end
2)index.html.erb
<h1>Posts#index</h1>
<p>Find me in app/views/posts/index.html.erb</p>
&l...
2006 Jun 12
5
Doing a simple search from the database?
I realize thi may be more complex issue than can be asnwered in this
post. But, what I need to do is create a simple query on my existing
tables via a search form. I have half my app done (I can write all the
info I want to my database), but pulling the data out dynamically is
giving me trouble.
I have both the "ruby for rails" book and the Agile Development book.
They both give
2006 Jul 04
8
writing to many_to_many table
...9;'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 => @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/.
2005 Dec 28
1
making has_and_belongs_to_many save more elegant
When a user creates a post I also want to save all the tags
associated with it. I do that in the post_controller like this
presently:
def save
@post = Post.new(@params[:post])
@tags = Tag.new(@params[:tags])
@post.user_id = session[:id]
if @post.save
@tags.title.split('','').each do |tag|
present_tag = Tag.find_by_title(tag.strip)
present_tag = Tag.create(:title => tag....
2007 Jan 10
0
SQLite3::CantOpenException
...rb:924:in
''find_every''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:381:in
''find''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/deprecated_finders.rb:37:in
''find_all''
#{RAILS_ROOT}/app/controllers/post_controller.rb:4:in ''index''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in
''perform_action_without_filters''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in
''perform_action_without_benchmark...
2011 Jul 25
4
[Rails 3.0.9] I have trouble about fields_for
Hi,all. I''m new bee to Rails and I have trouble about fields_for
method..
It isn''t show up between the <%= f.fields ~ <% end %>
Please teach me some advice.
Thanks!
#new/_form.html.erb
<%= form_for(@user) do |f| %>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<!-- Below
2005 Aug 08
7
Problems with ./scripts/generate scaffold
Hi all,
I''m new to rails after having used perl for most of these things, and am
trying to get my head around the generate script for a project playing
around
with.
If I do:
./scripts/generate controller Device
I get app/controllers/device_controller.rb
where I can then add:
scaffold :device
However, if I want to actually generate the scaffolding so I can make
some changes: