Displaying 20 results from an estimated 60000 matches similar to: "Problem with route defaults and caching"
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 %>
2010 Jan 21
2
will_paginate ?
Does anyone have experience with will_paginate?
I''m trying to use it with acts_as_ferret.
routes.rb
...
map.search ''/search'', :controller => ''notes'', :action => ''search''
notes.rb
...
acts_as_ferret :fields => [ ''body'' ]
notes_controller.rb
...
def search
if params[ :query ]
@query = params[
2005 Mar 05
3
routes inconsistency?
Hello,
As a small excercise in learning rails, I''ve been porting a very
simple website from SSI to rails (yep, a bunch of static files that
were previously served with a tiny bit of SSI magic are now served by
a database-backed rails, it''s total overkill, I know). Part of the
reason is that I''m trying to move from apache to lighttpd, and
lighttpd''s SSI for
2007 Aug 27
2
issue with edge rails and urls
I just switched our project over to Edge Rails, and I''m running into
this problem with all of my helper methods that call _url methods:
NoMethodError in ''ApplicationHelper home_link should generate a valid
home link when User.current and Profile.current is not set''
You have a nil object when you didn''t expect it!
You might have expected an instance of
2006 Jan 13
1
file_column - how to test for empty column?
I am using the excellent file_column, but have run into an issue.
I am wanting the user to be able to *not* upload an image if they so
choose. Then I am trying to determine if that column is empty or not,
and display a generic image if that column is empty.
I have tried both of the following code blocks:
<% if @newsentry.image -%>
<%= link_to(image_tag((url_for_image_column
2012 Oct 18
1
routing issue with mounted engine - Rails 3.2.8
I mounted the Forem::Engine in my app
MyApp::Application.routes.draw do
scope "/:locale" do
...
resources :sites, :only => [:none] do
get ''home'', :on => :collection
get ''events'', :on => :collection
end
..
mount Forem::Engine, :at => "/forums", :as => :forums,
constraints: lambda { |r|
2009 Aug 28
2
No route matches "/%20questions/showans/1" with {:method=>:g
Hi
i face this problem when i submit the information while evaluating the a
new page in a already done scaffold...........the new page is
"showans"......i write the link_to tag like this " <%= link_to ''Submit'',
:controller => " questions", :action => "showans", :id => @question.id
%>"
--
Posted via
2007 Jun 19
3
Nil object for nested resource
Hi all,
I have 2 models with a standard 1 to many relationship. I''m also using
REST on the two models and have added the appropriate code to the
routes.rb file.
scorecard.rb:
class Scorecard < ActiveRecord::Base
has_many :attributes
end
attribute.rb:
class Attribute < ActiveRecord::Base
belongs_to :scorecard
end
routes.rb:
map.resources :scorecards do |scorecard|
2006 Mar 18
3
Nil result on find & pretty print
I am new to Ruby and to Ruby on Rails and have spent the last few days
trying to get my head around it. I think I am already hooked but am
suffering badly from years of programming a non-OO RDBMS. I am trying
to learn by attempting to produce a system for my work.
I have a main table sdocs which has a field supplier_id which is an
entry in another table (suppliers) to lookup supplier name etc.
2010 Jul 09
2
Template is missing.... but it is there!
Hello friends!
I have an application to list different kinds of institution names. So
I have one table "instits" for the institutions and another table
"nome_instits" for their names. For test, I put two rows inside
"instits" and three names for the first institution and two names for
the last. Then I created this controller:
class ServInstitController <
2009 Jan 26
5
Please help with a routing problem
Hi All
I''m having some issues with the following routes problem.
The routes.rb file ...
map.resources :users
map.connect ''/users/view_payments/:user_id'', :controller =>
''users'', :action => ''view_payments''
The users_controller.rb file ...
def view_payments
@user = User.find[:params[:user_id]]
@payments =
2007 Nov 14
3
absolute urls in url_for vs. link_to
In both url_for and link_to, the :only_path param can be used to
determine whether the link url used is complete with hostname and path,
or just has the path (a kind of relative url).
However, in url_for it defaults to false (urls with hostnames), and in
link_to it defaults to true ( urls without hostnames, just paths).
Is there any reason for this discrepency? To me, it violates the
principle
2006 Feb 20
3
Caching of classes non working or Howto?
Hello!
I m new to rails. I m playing around with it on a SuSE 10.0 box with
ruby 1.8.2 and gems and rails and postgres. rails xyz creates a nice
rails application, with its directory and ruby script/server runs
webrick nicely and lets me see the page on localhost:3000.
I went with some tutorial to create a Hello page showing the time and a
Bye-Link to link to an Bye page.
cat
2010 Dec 27
4
Crazy routes
Hello!
I''m using restful_authentication and I would like to have diferent views
for logged users and not logged users. Logged users can edit and create
items, and not logged user could only list items and show its features.
In my routes file I have:
map.namespace :admin do |admin|
map.resources :items, :controller => "admin/items", :path_prefix =>
2009 Mar 06
2
Routes.recognize_path on more complicated Routes
For a permissions system i''m writing i''m extending the standard link_to
helpers to check if a user has a permission to perform that action
before displaying a link to clean-up my code so i don''t have to put if
checks all over them.
I''m trying to use..
ActionController::Routing::Routes.recognize_path(url, :method => method)
to get the action and controller
2012 Feb 12
3
Rails routes - destroy
Can''t figure out how duplicate routes are differentiated by rails ...
Read routing from inside out and API as well as a few tutorials but
still don''t get it!!! For example...
routes.rb
resources :minisections do
resources :questions
end
rake routes:
minisection_question GET
/minisections/:minisection_id/questions/:id(.:format)
questions#show
2006 Jan 25
1
Routes working with subdirectories repeat subdirectory...
Hi all.
Views associated with admin controllers must always specify both :controller
and :action when using link_to.
Example:
<%= link_to ''Edit'', { :controller => ''/raid_manager'', :action =>
''edit_raid_template'', :id => raid_template.id } %>
The above is being called from within the Admin::RaidManagerController. The
2006 Jul 05
3
list of users
Hi all,
I''m creating admin module. in that module i need to get the list of
users and also the projects created by the each user.
No doubt i''m getting the list of users. but i''m not getting the list
of projects done by each user..
This is my code::
<% for user in @users %>
<%=link_to
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
2006 Jun 13
2
four days on rails - nil object when you didnt expect it
Hi all,
Im trying to get my head around rails and to help along Im working
through "four days on rails" as this seems to give a good real world
example with multiple tables and relationships (the main thing I cant
work out!)
Ive got stuck. Some help would be really good here.
The controller has this code:
def list
@category_pages, @categories = paginate(:category, :per_page =>