I have this code in the view for delete button
<%= form_tag(recource_item_path, :method => :delete) do %>
<%= submit_tag('Delete', :class => 'delete') %>
<% end %>
I want to move it into the helper.
def delete_tag(path, name = 'Delete')
form_tag(path, :method => :delete) do
submit_tag(name, :class => 'delete')
end
end
But...
I need to load a yaml file into Hash,
What should I do?
...
I understand how to turn :controller, :action, :etc into a URL. I'm looking to do the reverse, how can the action that the rails router will call be found from the URL?
...
I have been using Rails for a couple years now and took a break away for a few months and just found myself back on a Rails application. The only problem is I don't know how to use bundler. I've been doing research and I find the command
bundle install
but what others are there and does this actually install the gems locally or just ...
Possible Duplicate:
how to check if my array includes an object - rails
I have array
array['one', 'two', 'three']
How i find that 'two' element present in array.
Is any method in ruby which can find this?
Thanks
...
how to add custom model controller and view during scaffolding if possible
...
Hi! I'm trying to get Ruby on Rails going on a Windows 2003 Server. I've installed the Mongrel service and Apache (and RoR, etc).
When I serve an app using just Mongrel, everything comes up perfectly.
So, now I am down to the Apache configuration... Apparently I can't seem to get that right. When I visit my pages, I am returned the...
Say I have the following in my console:
@user.favcolors
=> [#<FavColors id: 1, color_id: 18, fav_id: 1>,
#<FavColors id: 2, color_id: 19, fav_id: 1>]
@user.favcolors.count
=> 2
However, since fav_id is same in both results (1). I want this count to be 1, instead of 2.
Is there a way I can put where clause in the code @user.fav...
I have an association:
an author has many books;
and a book has many authors;
I need to use :through option(through a table named 'relations',has two column named 'left_id' (used as author_id) and 'right_id' (used ad book_id);
class Relation < ActiveRecord::Base
belongs_to :books
belongs_to :authors
end
class Author < ActiveReco...
I have some javascript code that is used in a few different pages in my website.
The code changes depending on some parameters, which are set in the Ruby on Rails controller.
For example:
acontroller.rb
def aview
@notes = get_notes
end
aview.html.erb (the actual code is much longer)
<% @notes.each do |note| %>
var <%=note[...
I have used a tutorial to create a widget for my site.
This widget now needs to be dropped into a complex page with existing CSS rules on important tags like *, body, ul, and li.
Is there a way to drop in this widget (currently a separate page with html, css, and javascript) into my webpage without the webpage applying all of its own ...
I am trying to use the Database mailer extension for my Radiant CMS application.
I have followed the exact same steps mentioned here.
http://blog.aissac.ro/radiant/database-mailer-extension/
When I try to run the rake task to migrate I get this error. I am fighting with this for a while now. Where and what am I missing?
Radiant version -...
I'm sure I saw a while back a rails helper method where .each in the view accepts a separator such as a comma.
So say I want:
- @results.each do |result|
= result.title
#to output
result 1, result 2, result 3
TIA
...
Where is "megabytes" method for fixnums defined? As far as I understand, its not a core ruby method, since its only available in rails.
ruby -e 'puts 5.megabytes'
In default rails installation it returns:
Loading development environment (Rails 2.3.8)
>> 5.megabytes
=> 5242880
At some point in my app something wrong happen, and now ...
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 li...
I have a standard rails observer configured:
class TipObserver < ActionController::Caching::Sweeper
observe Tip
def after_save(tip)
profile_link = link_to tip.profile.name, profile_path(tip.profile)
Profile.followers(tip.quality).each{|profile|
message = Message.new
message.sender = Profile.first
message.re...
Hello!
I'm making "user settings form", and stuck with HAML:
= form_tag('/')
- [1,2,3].each do |i|
= check_box_tag "accept#{i}"
= submit_tag
This results in "syntax error, unexpected kENSURE, expecting $end".
The working variant is
= form_tag('/')
- [1,2,3].each do |i|
= check_box_tag "accept#{i}"
= s...
Hi all,
I'm deploying my app to a live server running passenger on Apache. I've tested the app locally and my routes appear sound. I have my public controllers under app/controllers/content and my admin controllers under app/controllers/admin.
Despite everything working in the development environment i'm getting "The page you were look...
I am having trouble retrieving the URL of images uploaded via Paperclip.
I set the URL using the following code in my model:
has_attached_file :banner,
:path => "/www/banners/:foo-:id.:extension",
:url => "http://example.com/:foo-:id.:extension"
In my views, I can retrieve the URL just fine by runn...
This question is specifically for the user holden, but of course if anyone else can answer that works too..
Using the example at:
http://github.com/holden/authlogic_openid_selector_example
Is the openid code required to get the facebook connect working or are these parts of the example independent? I'm trying to get the kalasjocke fa...