Hello,
I'm writing fairly simple web interface for invoice/customer/contract database.
I would like to have the following structure for my models:
class Invoice < ActiveRecord::Base
set_table_name 't10_invoices'
set_primary_key 'id_invoice'
has_one :client
end
class Client < ActiveRecord::Base
set_table_name 't20_clients'
...
We have a custom action (:register) for our Location model. The supporting code is very similar to a standard :update. Since inherited_resources provided a "template" for us, we copied the update code from actions.rb, changing 'update_attributes' to 'register' and the flash message reflects the different action.
This doesn't feel very ...
I'd like to enumerate the paths for all of the plugins in a Rails application. Essentially #{RAILS_ROOT}/vendor/plugins/*, but that does not include plugins provided by gems, or specified explicitly, et cetera.
I've found one solution which I'll provide in an answer so you can vote for it, but it's pretty ugly. (Is that the proper eti...
Hi I have a problem implementing add to cart functionality in my rails e-commerce app. Here I am not talking about check out function. Just "add to cart". Items can be added to cart without requiring users to log in to their accounts. Once the user finishes adding to cart, then before check out user will log in. My problem here is what i...
I have a form that is used to record a transaction. Liquid is moved from one tank to another. My form takes the from tank and the to tank and the number of gallons transferred. i would like this to be entered into the database as two rows. The first would be the from Tank ID and a negative number and the second row would be the to Ta...
I am using Paperclip to upload an image to my Project model and I want to have an array of default images (not depending on the style, but different images) is that posible? To pass an array instead of just one URL to the :default_url option?
Thank you,
Nicolás Hock Isaza
...
Hello,
setup
Controller -> Action Index
results = Model.all (SQL Call)
View
Loop through and render partial from results. Call count for result row (SQL Call)
Partial
Manage result data and add point on Google map
I'm attempting to cache this page so I add caches_page :index to my controller. When I view this page it ...
I want to set up auto-login by giving the user a link/key they can use like http://domain.com/4yT67rw. The last 7 digits are random and assigned to the user model.
Is it possible to do this with custom routing? I imagine it would have to be something like a regex to detect that it is a key and not a model name or error.
Would be grea...
It's possible to replace db/migrate/* with the contents of db/schema.rb, so that you only have one migration step.
Do any of you ever do this? Why?
...
I need to add different values for each option tag in my collection_select cause Im trying to use this jquery plugin.... How do I do that?
Heres my collection select code
<%= e.collection_select(:id,State.all,:id,:name) %>
The output should be something like
<select name="state[id]" id="state_id" class="selectable">
<option value=""...
I'm trying to make a non-model form in ruby on rails, most of the examples I can find only have one field (say a search field) or use an old way of writing a form like this An Email Form with Ruby on Rails
If anyone could show me example code of a non-model form with say two fields for the view and how I access those fields in the contr...
Hi all,
Trying to implement the rails auto_complete plugin to help a user select tags that don't appear on the home page since there will be potentially hundreds of tags and only a small fraction can be displayed.
The way my navigation works is like this: I start with a category show page that displays all articles within that category...
In a thread on the ActiveScaffold Google Group, I worked out the basics of hiding fields based on the value selected in a SELECT drop-down. However I am now stuck on a similar but more complicated version.
I have the following models in a Rails application:
class Sale < ActiveRecord::Base
belongs_to :product
validates_numericali...
I know that http://api.rubyonrails.org/ is meant to explain methods etc in ruby on rails, but I need something that explains the explanation to me. It seems like a good resource, I'd like to understand it or perhaps it's time to give up.
...
I've been using Ferret as my full-text search engine in a small project I'm working on.
Through the documentation and a few examples online, i've been able to pull together a tag cloud generator using the full-text index to help with tag cloud generation using the IndexReader.terms method.
It's worked quite well up to now, when I want ...
I am new to rails so excuse the simple questions. I am creating a website for a company. That company wants to display it's clients on the site. I would like to allow the client to manage this themselves.
I am generating a table for the 'clients' and the three columns I would like to have are: Company Name, Company Description and logo...
The ruby gem for LinkedIn that I'm using is here: http://github.com/pengwynn/linkedin
When calling LinkedIn::Client.new with a valid API Key and Secret, I get this:
undefined method `tap' for #
Other people have had the same problem, see http://developer.linkedin.com/message/2363
Don't think anyone has proposed a solution yet.
...
I am new to rails so sorry for stupid questions. I have created section of the website I am working on where the client can post news about their clients. In the entry view I collect title:string content:text and link:string. How do I render the link:string as an actual link in the show and index views.
...
I am new to rails so go easy. I have two tables that I am trying to work with here, 'post' and 'category'.
The 'post' table includes the following columns, title:string content:text category:string.
The 'category' table simply contains name:string.
The idea is that the client can manage the categories and also when adding a new post,...
I have successfully followed Ryan Bates tutorial of paperclip and have it working correctly. The image attaches to the record and displays on the show.html.erb.I am wondering how to display it on the index pages. Below is what I have tried but not working. For reference, the table is 'review' and the photo is 'photo'.
<table>
<tr>
...