Displaying 20 results from an estimated 10000 matches similar to: "passing parameters through link_to"
2012 Sep 13
3
Creating a link_to from a collection_select
I want to be able to change one attribute of a link_to to be what is the
current selection of the collection_select. And needless to say I can''t
quite figure it out.
app/views/tasks/show.html.erb
Who would you like to assign this task to?<br />
<%= link_to ''Myself'', :controller => ''task_queues'', :task_id => @task.id,
:action =>
2011 Jan 24
11
Can't get login to work
Hi, could anybody help me try to get a login function working, I have
created a database for users called user1, I have the login screen set
up but when i hit login with a correct username and password, nothing
happens
I am expecting the lgin button to direct the user to the main page and
show the user as logged on, but nothing happens! Thanks!
Controller
class User1Controller <
2006 Aug 01
2
restful controllers - howto nest with link_to?
Hi List,
I''m trying to get my grip on the restful methods that are now part of edge
rails.
Making the first steps was impressive as well as easy because there are
already great resources on the blogs of early adopters:
http://www.ryandaigle.com/articles/2006/08/01/whats-new-in-edge-rails-simply-restful-support-and-how-to-use-itand
2006 Aug 18
3
equivalent of "puts" in rhtml
Hi everyone,
This seems so basic, and yet I can''t quite figure it out.
Say I have some code in an .rhtml document:
<%=
if @session[:user_id]
link_to somethingA
else
link_to somethingB
link_to somethingC
end
-%>
Only the link to somethingC will show in the second case. I understand
that the last thing returned from that else block is that last line. In
php i could just add
2009 Sep 12
3
Cannot get my password to validate
Hello,
I am working through the railsspace tutorrial, and i''ve noticed that
the password validation is no longer working.
I can get screen_name and email to validate, but for some reason, the
password field is ignored...
here''s what i have so far:
within user.rb file
PASSWORD_MIN_LENGTH = 4
PASSWORD_MAX_LENGTH = 40
validates_length_of :password, :within =>
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 =
2006 Feb 12
5
Passing Multiple Values In URL
Been a while since I programmed in Ruby and Rails and some of the
basic concepts I just loose so quickly. This one I can''t find any
examples of.
I want to pass two pieces of information in my URL. The :id plus I
want to pass my user_id. How do I pass it using the link_to?
Stupid question I know... but I can''t find the answer.
John Kopanas
http://www.kopanas.com
2008 Jan 21
7
undefined method error
Hello everyone,
I am following the Practical Rails: Social Networking
sites book. In chapter 7 photo gallery I am getting a
NoMethodError in Pages#show
Showing layouts/_menu.rhtml where line #12 raised:
undefined method `new_entry_path'' for #<ActionView::Base:0x52fa56c>
Extracted source (around line #12):
9: <% if is_logged_in? %>
10:
2010 Nov 20
6
syntax error, unexpected tSTRING_BEG
Rails is throwing this error
C:/Ruby/Depot/app/views/products/index.html.erb:28: syntax error,
unexpected tSTRING_BEG, expecting keyword_do or ''{'' or ''(''
...er.privilege == 50 ? {link_to ''Show'', product} : ''a'' );@out...
in line
<%= current_user.privilege == 50 ? {link_to ''Show'', product} :
2006 Jun 18
3
Ambiguous clause error
I''m trying to query one table to ultimately display the relate info from
another table. I have 2 tables: "posts" and "numbers". I''m trying to do
a query like this:
@numbers = Number.find(:all,
:conditions => [ ''(user_id) = :id'',
{:id =>
2009 Apr 29
7
problem with nil.user
Hi all, I''ve put new code into my app so that an administrator will have
extra privileges (administer users, edit pages). The error is:
''Couldn''t find User without an ID''
So the app is looking for a logged in user when the homepage is
accessed.
Heres my code:
site/index view:
<% if is_logged_in? and logged_in_user.has_role?(''Moderator'')
2008 Mar 12
3
undefined method `each' for #<Usrecart:0x46d1678>
I have the an error such as undefined method ''each''
pls can any one find the error from the code given below
<center><%=@b%></center>
<center><h2>WELCOME IN YOUR PROFILE</h2>
<%@usercart=Usrecart.find_by_user_id(@b)%>
<%if @usercart.blank?%>
<br>
<br>
<br>
<br>
<h2>THERE IS NO
2005 Dec 15
6
passing parameters to link_to OR better way to do this?
Hi All:
I''m writing my 1st Rails app and I can''t seem to find the answer on
the web or in the book.
I''m making a table, and I want to be able to expand a filename. The
code is basically as as follows below. In the last <td> entry, I want
to call an action and pass in the test_results_path, which I will go
and read a file and munge the data for a separate
2010 Aug 14
10
Redirecting after logging in
Hey everybody,
I''m trying to make an example of a small networking site, and when I log
in a user, it should redirect and show his profile, but I get the
following error:
NoMethodError in User#index
Showing app/views/user/index.html.erb where line #5 raised:
undefined method `screen_name'' for nil:NilClass
Extracted source (around line #5):
2: Your basic information
3:
2007 Aug 13
1
link_to image_tag puts a box round my image
I''ve got a rather long conditional statement that either displays a
link_to(image_tag(blah)blah) or just an image_tag (i''ve edited it a bit
to show the structure):
<%= (article.score_from_user(:user_id => session[:user]) != -1)
?
(link_to image_tag("/images/down_arrow_grey.jpg", :alt => "down"),
:controller=>"article", :action =>
2008 May 28
15
Help with output
I am having problems trying to get the output to work in an
application I have. Here is the example
THIS GIVES ME THE CORRECT VALUES
<!-- ######## Flooring ######### -->
<% if(params[:flooring]) %>
<tr><td colspan="4"><h2>Flooring</h2></td></tr>
<% for company in @companies
2006 May 12
1
Some error about adding.
Ok so I''m trying to make a little exchange 3 for 1 of 1 higher rank here
is the code in the controller:
def exch_link
@id = @session[:user].id
@type = @params[:type]
exch(@id,@type)
end
def exch(user_id,this_type)
@user = User.find(:condtions => "id = " + user_id)
@ranks =
2006 May 05
1
link_to - passing parameters
Hi. Is it possible to compose GET request using ''link_to'' and get passed
params like: params[:foo][:bar]?
2006 Jan 03
1
Passing parameters with link_to
I have following code in my controller:
class AlbumsController < ApplicationController
def list_by_year(year)
@album_pages
@albums = paginate :albums,
{ :per_page => 10,
:conditions => ["year = ?", year] }
render :action => ''list''
end
end
Now I want to make a link to the list_by_year action in
2011 Jan 06
2
Link_to parameters
Hello,
I would like to have a link_to automatically populate a field in the
form that it is linking to.
For example (excuse my silly words, im trying to make a point)
<%= link_to "Add a COOL Post", new_post_path, :howcoolisit => ''COOL''
%>
<%= link_to "Add a NOTCOOL Post", new_post_path, :howcoolisit =>
''NOTCOOL'' %>
Then,