similar to: Edit not working with named routes

Displaying 20 results from an estimated 100 matches similar to: "Edit not working with named routes"

2006 Jul 18
2
A quick question on forms
I want to change parts of this form in order to use default values (with a disabled input). The problem is if I change it from text_field to text_field_tag that part of the form stops functioning. It seems like a silly question, but its been driving me crazy. Any help would help. Steve. <%= error_messages_for ''post'' %> <!--[form:post]--> <p><label
2009 Dec 03
2
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: url.com/username/blog/post_id 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,
2012 Apr 04
1
Subscript Error
json_dir is a list of JSON lists mapping lat/long route points between locations using CloudMade's API. post_url is the URL of the HTTP request for (n in json_dir) { i = i + 1 if (typeof(json_dir[[i]]) != "NULL") { if (i == 1) { dat_add <- ldply(json_dir[[i]], function(x) t(data.frame(x)), .progress = "text")
2006 Apr 02
2
Focus on ajax newly-created form element
I have an ajax method that creates a new form. I want one of the input boxes to be focused when the form gets displayed. So in my inline RJS I have page << "document.getElementById(''post_title'').focus();" The input box is being created with <%= text_field ''post'', ''title'' %>, so the ID should end up being
2007 Jun 01
0
Okay, new question - dealing w/ logging in restrictions (controller?)
Hey all, so if you read my previous thing about nested routes - I''m just not going to do with them anymore. Anyway, so my controller has a before_filter on the edit action; which checks to see if the current post''s user, is the same as the currently logged in user, if true then they can edit, otherwise not. def check_user if current_user.login != @post.user.login
2010 Apr 22
0
How to automatically set params based on passed object when generating a route?
Hi, having i.e. a post model that has many categories - is it possible for member routes like i.e. post_path(post) to generate path like "/ posts/:post_category_name/:post_id" without manually passing the category param? Does anyone know if there''s a gem or if I can simply override the post_url method to automatically set category from post object? The best I could get right
2005 Oct 24
3
Unable to use forms after login generator
I''m using rails 1.8 and login generator 1.1. I''m using rails to manage the contents of my website. I decided to put an admin page for the content management. For the sake of convenience, I used Login Generator. Now when I go to edit or create new content (for now, just posts), it gives me the following error (this one is for new posts): NoMethodError in Goblin#new Showing
2006 May 18
2
attempt to override the ''tag'' method
I want to override the ''tag'' method in ActionView::Helpers::TagHelper to do some generalized error handling similar to the way scaffolding puts a red border around fields that fail validation. I''ve created a file lib/rails_patches/tag_helper.rb which contains the following. module ActionView module Helpers module TagHelper alias_method :orig_tag, :tag
2006 Jun 09
9
Opinions on catch-all routing?
I remember reading somewhere a tip on improving your search engine ranking, by forming URLs that included relevant text, e.g. www.domain.com/article/man_eats_hat. In the rails app that I''m writing, I''ve noticed I can set this up very easily by appending the post title (after downcase.split.join(''_'')) to the post link. So, blog.com/posts/4 can easily also be
2006 Aug 16
5
Rails theory question, where to put a join query
The is something I wrestle with a bit when I construct joined queries.. Perhaps some experienced insight will straighten this out for me. Say you have two tables with two models, ''authors'' and ''posts''. an author has_many posts, a post has_one author. You need methods to do the following queries: find_author(postid) find_posts(authorid) And you are doing a
2007 Jan 02
4
allow stubbing of previously defined methods such as "id"
On my current project I needed to create a stub that responded correctly to the id message. Here''s the change I put into my copy of head. Index: lib/mocha/mock_methods.rb =================================================================== --- lib/mocha/mock_methods.rb (revision 1114) +++ lib/mocha/mock_methods.rb (working copy) @@ -68,6 +68,7 @@ method_names =
2005 Dec 17
0
No javascript fallback
AJAX is good for a lot of things, but javascript is not always available. I think the new RJS templates are very good: http://www.codyfauser.com/articles/2005/11/20/rails-rjs-templates And they could be used to create a simple, automatic no javascript fallback. An example: You have a controller called PostsController. There is an action "new". The view displays a form. The form
2007 Jul 06
0
Removing One Element From a Serialized Form
Hi all, I''m trying to serialize a form with the exception of one specific element. Serializing the form in a hash (without pulling out specific elements) works: <li> <%= link_to_remote ''(Save)'', {:url => post_path(@post), :with => "$ (''post_form'').serialize(true)" }, :method => :put %> </li> The generated code
2009 Apr 25
0
'get_user_list' function not working
i want to show fullname by using fuction call ''get_user_list'' , but its not working..?? tis s user.rb ( def full_name self.first_name + " " + self.last_name end ) my post controller ( def get_user_list return User.find(:all, :order => ''last_name ASC'').collect {|user| [user.full_name, user.id]} NameError in
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 Jul 12
1
odd habtm behavior? or is it me?
Hello List, I''m a bit spent on this problem, and my code might be whack. I seem to be encountering a problem where the primary key on a join table is not being resolved correctly. I will elaborate after some code bits. I am creating the join table using migrations, and relevant model code is this: class Post < ActiveRecord::Base has_and_belongs_to_many :records
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
2008 Jun 02
2
Cannot log in/authenticate within RSpec Story
I''ve been slamming my head against a wall for a while now, and would like some help. I believe this is session related. I have a story that looks like: -------------------------------------------------- Given that a post exists And I am logged in When I visit the post details page Then there should be a link to add a new comment
2006 Jun 20
0
No opening form tag in rendered HTML
I cannot get my form to submit for my simple blog site (based on the "How to Build a Blog Engine in 15 Minutes" presentation) Any ideas? Thanks, Tom ---------------------------------------------------------------------------- Here is my code: #Post controller class PostsController < ApplicationController def index list render :action => ''list'' end
2009 Feb 24
2
Error going through the "Getting Started" tutorial
Hi, I get this error on step 9 of the Getting Started tutorial: NoMethodError in PostsController#index undefined method `accepts_nested_attributes_for'' for #<Class: 0x23fbc48> Does someone know if it''s a bug? Cheers, Beren --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on