Displaying 20 results from an estimated 10000 matches similar to: "No route matches "/%20questions/showans/1" with {:method=>:g"
2006 Jan 05
2
help - edit without using scaffold
Hello,
What am I doing wrong? The code below does not show the current record for editing.
def edit
@user = User.find(params[:id])
end
def update
@user = User.find(params[:id])
if @user.update_attributes(params[:user])
flash[:notice] = ''User was successfully updated.''
redirect_to :action => ''show'', :id => @user
else
render :action
2006 Jan 08
4
scaffold uses link_to for destroy
Hi,
I wonder why scaffolding uses a link_to tag for the destroy links.
Seems like these should be POST requests with button_to. The Rails
book dedicates pages 335-337 to this very issue.
Peter
2010 Aug 12
10
Scaffolding working...kinda
Hello all. I''ve been working through some online tutorials, learning ROR
and have a question on scaffolding. Through the command promt i''ve ran
the command:
$ script/generate scaffold Albums
This created the controllers, helpers, models, and views.
I have a database table titled "albums" and have two records saved
within
The problem is that the scaffold command did
2011 Nov 12
4
No route matches [GET] "/microposts/304"
Hi all,
I''m learning Rails by Example (chapter 11), by Michael Hartl (
http://ruby.railstutorial.org/chapters/user-microposts#top) but I got no
route matches when I try to delete one micropost.
the _micropost html is...
<tr>
<td class="micropost">
<span class="content"><%= micropost.content %></span>
<span
2005 May 01
5
Example using Builder::XmlMarkup and .rxml files?
Greetings,
I''m a newby to both "R"s in RoR. I would like to use Builder::XmlMarkup
to generate my pages. If there is a working downloadable example
somewhere, that would probably be enough. Otherwise, here''s what
I want to do:
With the following controller:
class AccountsController < ApplicationController
layout ''accounts''
model :account
2006 Apr 28
9
[AWDR] Tutorial in A4 wont ''destroy'' items
Hello,
I''m working through the tutorial, and I''ve run into a little snag. In
the first part of the tutorial, the destroy link is not working
correctly. I can''t figure out where I goofed. Removing :confirm doesn''t
seem to resolve the issue.
Thanks,
Randy.
development.log
----->8-----
Processing AdminController#destroy (for 127.0.0.1 at 2006-04-27
2006 Jul 07
8
Possible name clash?
Scenario:
Table in database has two fields, id and category (table name is:
categories)
Controller is named category_controller.rb
Model is named category.rb
Helper is named category_helper.rb
Form is named list.rhtml in view\category directory
The code in play on the form is (from generating scaffold):
<% for category in @categories %>
<tr>
<td><%=
2006 Jan 11
5
stack level too deep problem
Hi all, I''m trying to overload the link_to function, (to disable link_to if
the user has no access right)
this is my code, it work the first time I run the application, the second
time I refresh the page I always get "stack level too deep error"
module UsersHelper
include ActionView::Helpers::UrlHelper
alias_method :link_to_original, :link_to
def permission?
true
2006 May 04
9
Help: wrong number of arguments (0 for 1)
Is it my environment? Is something wrong, cause I thought this should
just work?
I have a simple table and I created a model and a controller:
ruby script/generate controller Restaurant
ruby script/generate model Restaurant
I edited the controller to this:
class RestaurantController < ApplicationController
scaffold :Restaurant
end
I run it and:
http://0.0.0.0:3000/Restaurant works fine,
2008 Apr 01
1
Navigation Problems
Hi,
I am having problems with my page. I have a banner and navigation bar in
controller_name.rhtml in app/views/layout. Can someone please help?
Thanks
In the navigation bar, I have the following links:
Category1
Sub-Category1
Sub-Category2
Sub-Category3
Sub-Category4
Sub-Category5
Sub-Category6
In the main content, I have the following links:
Sub-Category1 edit delete
2014 May 16
0
(Beginner) ActionController::UrlGenerationError - No route matches
(Using Rails 4.1.1 with Ruby 2.1.1 on Mac OSX 10.6 Snow Leopard)
I'm doing a Rails tutorial (in case you are interested in: It's
http://guides.rubyonrails.org/getting_started.html), and I'm stuck on
the following:
I create in some erb file a link using
<%= link_to 'Add new weird stuff', controller: new_article_path %>
and this raises the exception
2007 Nov 28
3
overriding rest show route but not delete
hi, lets say routes.rb has
map.resources :foo
and I want the show action to have a diffent url, so I add (after the
above line)
map.foo ''/bar/:id'', :controller => ''foo'', :action => ''show''
this works fine, including foo_path( :id => "1") => /bar/1
and <%= link_to ''Show'', foo %>
2006 Jun 10
6
table associations
First, thanks to everyone who replied to my pluralization question
from before!
Today I was trying to do what I think is called a "chained accessor".
I have an "events" table and each event has one user. Instead of
seeing the id number for each event''s user, I''d rather display the
names of users instead. I tried to do this:
class Event <
2009 Jun 11
4
Using view helpers and route helpers in a model
Hi there,
I am trying to get something working and its driving me crazy. I have
been looking around for solutions to getting view helpers working in
models and for the most part I find this solution.
Add the following in the model you want to use them in
include ActionView::Helpers::UrlHelper
include ActionController::UrlWriter
However, when I try something like
2006 Apr 20
5
nil object when you didn''t expect it
Hi,
I''m new to rails and finding it hard to figure out what this error is
referring to. Can anyone help please?!!
NoMethodError in Registeredphone#list
Showing app/views/registeredphone/list.rhtml where line #24 raised:
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.txtForename
Extracted source (around line #24):
21:
2006 Feb 23
6
Search Forms with Pagination
Hi there everyone, I''ve recently moved to RoR and am still struggling
with the basics of what used to be second nature in php, so on with
my question:
I have a database with products, and I need to create a search form
that paginates the results. What I have so far in my controller is:
def list
# If the values are nil, then set them, otherwise wrap them in %
# Also,
2010 Jul 27
13
3.0.0rc ActionController::RoutingError No route matches
Have been developing on 3.0.0beta4 and just updated to 3.0.0.rc.
When I try to link_to() a User object that previously had worked, I
get the following:
ActionView::Template::Error (No route matches
{:action=>"destroy", :controller=>"games", :id=>#<User ..... >
Yet I have in my routes.rb file has resources :users and my "rake
routes" shows:
2008 Jun 22
3
Routing Error No route matches "/employee/list" with {:method=>:get}
hi,
I am very frustrated by this error when I just put together a very
simple project from one of the textbook on RoR:
Routing Error
No route matches "/employee/list" with {:method=>:get}
For your reference,
#The following is EmployeesController.rb
class EmployeesController < ApplicationController
scaffold :employee # create scaffold code for controller
#
2006 Feb 27
3
form questions
I have a very simple form that looks allows an input for an error code
and then give the show page from the scaffolding if the error code is
in the database and a notification on the list page, again from the
scaffolding if not.
Here''s the form:
find.rhtml
<h1>Find error</h1>
<%= start_form_tag :action => ''search''%>
<p><label
2006 Jul 07
5
link_to: link is missing id
I''m using a legacy table, where the unique id is not ''id''
I have a Model class like the following:
class Article < ActiveRecord::Base
set_primary_key "ARTICLE_ID"
end
however, using a link_to like the following (modified scaffolding),
the link has no id value:
<% for article in @articles %>
<tr>
<% for column in