search for: comments_controller

Displaying 16 results from an estimated 16 matches for "comments_controller".

2009 Apr 15
2
Getting Started with Rails - post_comment_url
Hi, Thanks for a wonderful Getting Started with Rails. I am up to 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&quot...
2011 Jan 25
0
Rails 3 - Helping with a Commenting Module
...o a hitch this morning, possibly because of my use of nested resources. Essentially, I now have a URL like: /projects/3/albums/6/attachments/84 When I comment on that page, I get the error: ActiveRecord::RecordNotFound (Couldn''t find Project without an ID): app/controllers/comments_controller.rb:102:in `context_object'' app/controllers/comments_controller.rb:14:in `create'' My routes file looks like: resources :projects do resources : albums do resources :attachments end end resources :attachments do resources :comments, :only =&g...
2009 Feb 21
1
undefined method user_id
...utes='' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1505:in `initialize_without_callbacks'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:225:in `initialize'' #{RAILS_ROOT}/app/controllers/comments_controller.rb:8:in `new'' #{RAILS_ROOT}/app/controllers/comments_controller.rb:8:in `create'' This is my comments controller: class CommentsController < ApplicationController before_filter :login_required def create @photo = Photo.find_by_user_id_and_id(params[:user_id],...
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
2009 Aug 16
5
any help with captcha in my comments ?
...ot;=>"Add Comment", "post_id"=>"19", "authenticity_token"=>"B5dll5fTaDO+ZrEs1S0KkYsmK8VMzCOeDEf731w21zY=", "captcha"=>"asdasd", "_"=>""} SyntaxError (/Users/webstic/Sites/weblog/app/controllers/comments_controller.rb:11: syntax error, unexpected kELSE, expecting kEND else ^): this is my code: class CommentsController < ApplicationController include SimpleCaptcha::ControllerHelpers def create if simple_captcha_valid? @post = Post.find(params[:post_id]) @comment = @post.c...
2010 Aug 05
3
how to ? Rails 3 ActiveRecord eager loading and AREL
...ent belongs to article Comment has a scope defined like this (app/models/comment.rb) : ---------------------------------------------- def recent where ["published_at >= ?", 2.days.ago] end ---------------------------------------------- In the ArticlesController (app/controllers/comments_controller.rb) : ---------------------------------------------- def index @articles = Article.includes(:comments) end ---------------------------------------------- In the view (haml) (app/views/articles/index.html.haml): ---------------------------------------------- - @articles.each do |article|...
2006 Feb 24
4
too many components?
okay. on /posts/show/13 i have show.rhtml, which does render_component(:controller=>''comments'', :action=>''display_comments'', :id=>post.id) on comments/display_comments i iterate through the comments and then, display_comments.rhtml render_component(:controller=>''comments'', :action=>''new'', :id=>@id)
2006 Mar 05
1
access methods defined in helper
Hey How do I access methods that I have defined in helpers? __________________________________________ Helper id_browser_helper.rb: module IdBrowserHelper def table_identities(message) render_text message end end ___________________________________________ Controller id_browser_controller.rb: class IdBrowserController < ApplicationController def view_genre()
2009 Jun 08
3
Will Pagination links getting not behaving as i wanted.
...formed action. You have any idea how to fix this problem ? NOTE: i am updating list after creation of resource record that time pagination links goes to create action. I have -- resource comment which is polymorphic in nature. resource post, forum, etc. they have many association with comments, comments_controller where creation and list population is written. Sandip R~ -- Ruby on Rails Developer http://sandip.sosblog.com http://funonrails.wordpress.com www.joshsoftware.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups &q...
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> <p> <% f.fields_for :picture do |p| %...
2007 Jun 28
1
DRb server crashing
...e_record/transactions.rb:105:in `save'' [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/transactions.rb:117:in `rollback_active_record_state!'' [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/transactions.rb:105:in `save'' [RAILS_ROOT]/app/controllers/comments_controller.rb:52:in `create'' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:104:in `call'' [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:104:in `respond_to'' [RAILS_ROOT]/app/controllers/comments_controller.rb:51:in `cre...
2010 Jul 27
7
trouble with remote_form_for & html_update
...abel></h5> <div id="body"><%= form.text_field :body %></div> <p><%= submit_tag ''Comment'' %></p> <% end %> The form works i.e on refreshing the page the new comment is seen in the comment partial. From comments_controller def create @story = Story.find(params[:story_id]) @story.comments.create params[:comment] flash[:notice] = "Thank you for commenting" end This is create.rjs <script> aremark = page.getElementById("aremark") page.replace_html(''aremark'', :par...
2010 Sep 17
25
Trying to look up comment through an ID, but failing
...xt to the parent comment. It will send in a parameter to the ''new'' comment view, like so: | <%= link_to "Reply", new_comment_path(:in_reply_to => comment.id) %> The form will use the :in_reply_to parameter in order to save that id as the parent id, like so: comments_controller#new: @comment_parent = Comment.find(params[:in_reply_to]) comments_form view: <%= form_for([@comment]) do |f| %> <%#= render ''shared/error_messages'', :object => f.object %> <div class="field"> <%= f.label :title %><br /&...
2010 Sep 21
25
Working in install acts_as_commentable, On create, error: "unknown attribute: book_id"
...l, I then added a comment form on my book show view: <% form_for(@comment) do|f| %> <%= f.hidden_field :book_id %> <%= f.label :comment %><br /> <%= f.text_area :comment %> <%= f.submit "Post Comment" %> <% end %> Then in the controller (comments_controller.rb), def create @comment = Comment.new(params[:comment]) Book.comments.create(:title => "First comment.", :comment => "This is the first comment.") end Then when submitting a comment, it returns the error: "unknown attribute: book_id" From the log:...
2007 Aug 09
7
Integrating polymorphic models into controllers views? how?
I''m having trouble trying to get this to work. How the heck do you get a polymorphic controller to work? Especially integrating it with a view? Let''s say that we have shows, and episodes, then comments. A show has many episodes, an episode has many comments. the route is /shows/1/episodes/1/ Now to add a comment to that episode, how would I do it? Let''s say that the
2010 Oct 14
7
undefined method?
I''m trying to learn rails as I go along, and having a bit of trouble. There is an undefined method cropping that I don''t know why rails thinks should be there. Firstly, I''m using rails 3, ruby 1.9.2 I have a controller with an index action This part works fine, but i am trying to add a comment form to the page that is rendered by that index action. Supposing my