Displaying 20 results from an estimated 30000 matches similar to: "REST and custom routes"
2005 Mar 03
0
routes and link_to
Hi,
I have defined this route as the first one:
map.connect '':controller_prefixx/:controller/:action'',
:controller_prefixx => ''rails_right''
(for the test, I put a second x at the end to be sure I don''t collide
from the :controller_prefix used in rails).
In my view, I have this:
<% @rights.each do |right| %>
<tr>
2009 Mar 14
2
Pobrem with REST routes
Hi first at all sorry if mu english is not the best.
I have this models:
Encuesta->titulo and description are string. Encuesta has_many
:preguntas
Preguntas-> texto is string, encuesta_id and orden are integer. Pregunta
belongs_to :encuesta and has_many :soluciones
Soluciones-> texto is string, pregunta_id and orden are integer.
Soluciones belongs_to :pregunta
Routes:
map.resources
2008 Aug 01
2
REST error
Hi i given in routes.rb as
map.resources :students, :member => [:departments => :get]
and rhtml i given link
<td><%=link_to "Departments", departments_student_url(student)
%></td>
in students controller
def departments
@student= Student.find params[:id]
# @departments = @student.departments
end
when i click the departments link it showing error like
2008 Mar 07
2
Trouble using RESTful helper
Hi,
I am trying to get into this REST thing, I have a nested resource
whith the following route:
ActionController::Routing::Routes.draw do |map|
map.resources :members
map.resources :clubs do |club|
club.resources :members
end
map.connect '':controller/:action/:id''
map.connect '':controller/:action/:id.:format''
end
Everything worked ok for this
2011 Jun 15
1
uninitialized class variable @@env in OCI8
Can anyone help me with the uninitialized class variable @@env in OCI8
error raised in my app\views\xxxx index.html.erb file
Thanks in advance
Below is the code and the result of bundle show. I am using Windows 7
<h1>Listing comics</h1>
<table>
<tr>
<th>Title</th>
<th>Issue</th>
<th>Publisher</th>
2008 Feb 29
3
How to DRY REST admin path in URLs?
Hi everyone...
For almost all of my objects I put a series of classic REST admin links
in views. For example, for a ''user'', I have
<%= link_to "Show", user_path(user) %>
<%= link_to "Edit", edit_user_path(user) %>
<%= link_to "Destroy", user_path(user), :confirm => "Are you sure",
:method => :delete %>
I am tired
2011 Feb 12
5
link_to a action in the controlles is not called
i have a link where it has to call a method defin in todoscontroller
named say_when but show is called
<td><%= link_to ''Say when'', todo, :action => :say_when ,
:remote => true %></td>
class TodosController < ApplicationController
# GET /todos
# GET /todos.xml
def index
@todos = Todo.all
respond_to do |format|
format.html #
2008 Dec 14
2
custom REST action - template question
Hallo phorum,
i have custom rest action.
routes.rb:
map.resources :schools, :collection => { :graduations => :get }
SchoolsController:
def graduations
@schools = School.graduation(true)
end
link somewhere in navigation:
<%= link_to ''Schools with graduation'', graduations_schools_path %>
All works OK for me, but Rails needs (of course) a template for
controller
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
2008 Oct 18
0
Link_to + PUT + restful routes problem
Hi,
I''m trying to use link_to to access the Update action + add some extra
parameters. I''m using the default rest routes.
I can''t get it working.
When I use: <%= link_to '' Accept'', invitation_path, :method => :put, :id
=> ''1'', :command => ''accept'' %>
I can get into the Update action but the
2008 Feb 20
1
link_to weirdness, related to namespace?
Hi,
In my app/views/admin/clieint/_searchresults.rhtml partial, I have ...
<% for user in @users %>
<tr>
<td><%=h user.ship_to_first_name %></td>
<td><%=h user.ship_to_last_name %></td>
<td><%=h user.email %></td>
<td align="center"><%= link_to ''Show'', {:action =>
2011 May 19
0
Unable to find the image path via file system using the paperclip plugin through the get method
Hello all,
with great difficulty , I guess I have finally been able to find the
appropriate git commit of paperclip which would suit my project''s config
which is Ruby 1.8.7 and rails 2.0.2.
I am trying to implement a POC before I integrate paperclip in my
project. The POC is basically implementing each post with an appropriate
image beside it. It seems to pretty much work, its just
2007 Jan 16
2
RESTful routes and Mime::Type
Hi all
I''m using RESTful routes combined with the to_csv plugin and would
like to know if there''s a nicer way of generating a link to fetch the
CSV file than just making a hard link. This is what I use for the
moment (and it works btw):
<%= link_to("Export as CSV","/companies.csv") -%>
I would expect the link helper to have something like
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 %>
2009 Jul 26
2
How knows my paths in link_to? If I do not defined.
Hello,
It´s my first post here. :)
I´l following the guide of Ruby, but I need to know how the Ruby knows
my path to other pages if I did not define anything, like this:
app/views/posts/index.html.erb:
<td><%= link_to ''Show'', post %></td>
<td><%= link_to ''Edit'', edit_post_path(post) %></td>
Other
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
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 <
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 Jun 13
1
How to give conditions in rails
Hi, I have Holiday table. the fileds are id,holiday_date,description. i
added new records and list them also. when i listed all the records in
the database are listed but i want to list only one particular year
records. my holiday_list.rhtml page is as follows
<%= stylesheet_link_tag "common", :media => "all" %>
<%= error_messages_for ''holiday''
2008 Mar 13
3
Refreshing a page gives a "stack level too deep" error.
I''m converting our app into restful rails. A couple of my classes
(Resource and Asset) have a has_many relationship with each other -
here''s the routes:
map.resources :assets, :has_many=>[:resources]
map.resources :resources, :has_many=>[:assets]
I''m getting something weird in my view pages. When i go to
/resources/4/assets
it works. I go to the page