Hey there,
I'm having a little issue...I setup a rails application that is to serve a german website. To make use of Rails' internal pluralization features, I kept all my models in english (e.g. the model "JobDescription").
Now, if I call "http://mysite.com/job_descriptions/", I get all my job_descriptions....so far, so good. Because I ...
After following a tutorial Ive found. Im now redoing it again, without the scaffolding part, to learn it better.
However, editing my \app\views\home\index.html.erb to contain:
<h1>Rails test project</h1>
<%= link_to "my blog", posts_path>
I get an error:
undefined local variable or method `posts_path' for #<ActionView::Base:0x4e1d95...
Hi All,
What is the most straightforward mechanism by which to "link_to_remote" and popout a window with the data? I need "link_to_remote" because I need to pass certain data along with the url without redoing my routes. If this would be better served by a "link_to" without the need to redo my routes, I'm all for it. I simply can't g...
Wondering how to do this.
I have a month helper and want to render a list of each month.
If you click on the month it would then pass the number value . I want to produce a list like this
Choose a month
January - February - March - April - May.....
That are links. My helper looks like this.
MONTHLIST = [
[ "January", "1" ],
...
I am looking to do something similar a wordpress slug where I have a URL like this while maintaining RESTful routing:
http://foo.com/blog/2009/12/04/article-title
The reason I am interested in keep RESTFUL routing is that I am unable to use many plugins because I am using custom routes.
I have already done the RESTful appearance with:...
How do i use a link_to inorder to go to a specific (html) ID on a page normally
if i wanted to go to the "whatever_id" on a page i could use
<a href="http://www.example.com/index/mypage#whatever_id>Click Here</a>
but i would like to use my link_to
<%= link_to "click here" , {:action => "mypage", :controller => "index" }, :id => "...
I'm writing a ruby-on-rails library module:
module Facets
class Facet
attr_accessor :name, :display_name, :category, :group, :special
...
URI = {:controller => 'wiki', :action => 'plants'}
SEARCH = {:status => WikiLink::CURRENT}
#Parameters is an hash of {:field => "1"} values
def render_for_search(paramete...
I have a rails helper using the structore below, but when I use it I get the message
undefined method 'link_to'
The helper is arranged as:
module MyHelper
class Facet
def render_for_search
link_to("Value", params)
end
end
class FacetList
attr_accessor :facets
def initialize
#Create facets
end...
Hi all,
I'm trying to send a variable through a link_to, without using url query in Ruby on Rails, from one controller's index view to be used on another controller's index.
Basically, I need to pass the Turma.id (school class id), to the Elementos_turma(peoples in the class) controller, so I can use it and filter the index: ElementosT...
What's the standard for applying default values to Rails models from links? Here's the situation:
There is a model in Spree called ProductGroup, which is a collections of settings defining how to find a Product (based on a bunch of property values you set). I want to be able to use this structure for defining common ProductGroups:
E...
I've ran into a ror problem using the link_to. Why does my link to use the GET method and my button_to use the POST method, after I specified my "method"=>"post" within the link_to parameters?
View:
<%= button_to "pdf", :action => 'getquote' %>
<%= link_to 'pdf', {:controller => 'inventories', :action => 'getquote', :method => :post }...
I have the following wrapper method for link_to:
def link_to_with_current(text, link, condition, *args)
current_class = condition ? 'current' : nil
link_to text, link, :class => current_class, *args
end
When called with this sample:
link_to_with_current 'My Link', '/mylink.html', true, :id => 'mylink'
The following link is gene...
Is there a way to pass parameters with a link_to call without it showing up on the URL? I'm making a simple star-rating system, and I'm basically making each star an image link that passes its value as a parameter to a new rendering of the same page. The helper code looks like this:
def stars_generator(edit_mode = false)
@rating = pa...
I have a resource defined in routes.rb like so:
map.resources :users
I like using the cleanest link_to option, which would be:
link_to @user
I'd like to add an additional parameter to this call, though: "view=local"
If I were using the user_path, I'd do this:
link_to user_path(@user, { :view => 'local' })
Is there a way to get ...
I'm using
link_to 'My link', path(:arg1 => session[:arg1], :arg2 => session[:arg2],:arg3 => anyobject.id), :method => :post
but the html link being generate includes (arg1,arg2,arg3) as url query parameters.
How can remove them? Did I miss something in the docs?
Thanks
...
i am wondering if the basic link_to syntax is completely broken in current rails3 master or if i am doing some wrong syntax here.
= link_to "name", nil, :onlick => "alert('Hello world!');"
should actually produce an alert on click. very simple. does not work on my rails3 project! (also no error output!) any ideas?
for the general lin...
Hi,
My link_to tag is:
<%= link_to("My test title",{:controller=>"search", :action=>"for-sale", :id=> listing.id, :title => listing.title, :search_term => search_term}) %>
and produces this ugly URL:
http://mysite.com/search/for-sale/12345?title=premium+ad+%2B+photo+%5Btest%5D
How can I get link_to to generate:
http://mysite.com/...
Hi,
Not sure how to frame this so here goes....
I have the following link_to tag:
<%= link_to("My test title",{:controller=>"search", :action=>"for-sale", :title => listing.title, :search_term => search_term, :id=> listing.id}) %>
and the following custom route in my routes.rb file:
map.connect ':controller/:action/:title/search_it...
Hey,
I'm looking for a way to use something similar to link_to_unless_current but for sub URLs, so for instance for both these URLs:
/entity_name/
/entity_name/123
it will not result as a link. How can I achieve that in Rails?
UPD: Resolved it my own custom way, please Ruby savvy let me know if it's good.
module ApplicationHelper
...
So I'm trying to use link_to to create a link in my Rails app and trying to add a CSS class to certain links. The problem that I have is that when I add my html options to the link_to arguments, the links don't get created and I end up with nothing. Here's my code:
<%=link_to( image_tag(@beetle.icon_img, :width=>30, :alt=>"Beetle", :bor...