Hi
I'm doing this:
@snippets = Snippet.find :all, :conditions => { :user_id => session[:user_id] }
@snippets.each do |snippet|
snippet.tags.each do |tag|
@tags.push tag
end
end
But if a snippets has the same tag two time, it'll push the object twice.
I want to do something like if @tags.in_object(tag)[...]
Would it be poss...
Given these relationships:
class Account < ActiveRecord::Base
has_many :employments
has_many :people, :through => :employments
accepts_nested_attributes_for :employments
end
class Employment < ActiveRecord::Base
belongs_to :account
belongs_To :person
end
I'm trying to list the employment records for an account:
<% form_for...
I have a view for a controller called "show". Inside that view, i want to render the contents of another controller's view - and obviously, the logic for the form on that view to talk to the controller it belongs too. How do I do this? I am fairly new to rails and I'm not 100% confident with the framework yet.
You could almost consid...
Hello, I'm a developer but I never used php nor ruby on rails. I would like to create a small e-commerce website.
I found out 2 solutions that seems very good, Prestahop and Spree.
Which one would you recommend if I want to be able to customize the skin, calculate different taxes for different countries, use different languages ...
...
Ok, I am new to rails so I hope I explain this well. I seem to have a problem with a form collecting the proper information. Work in one spot and not another. Here is the situation.
I have created a blog with three tables, posts, comments, and votes. I have comments working correctly and votes working partially. Here is what I mean.
...
hi friends,
iam working on RoR code, i want to know how to find two digit precision for the numbers
a = 0.7
b = 5
thanks
...
def reparto_de_ventas_por_marca
#obtener los montos de las ventas en el periodo comprendido y sumarlas
@ventas = Venta.find(:all)
@marcas = Marca.find(:all)
title = Title.new("Ingresos de este mes: #{@total}")
pie = Pie.new
pie.start_angle = 35
pie.animate = true
pi...
Is there a helper of some sort? I want to make a javascript file, put it in the rails directories somewhere, and have the file be included in a view so I can use the methods and functions I declare in the file.
...
I have an application where user can see a list of cells. For each cell the user can see two images of the cell as popup menu. The problem is that all images are downloaded when a list is selected and that makes my page very slow.
I would like that the image is downloaded only if mouse is rolled-over the link.
For information: I’m using ...
I've got the following models:
An Invoice has several statuses: Initially it's "draft", then it can be "sent", and "payed"
An Invoice has_many InvoiceLines. InvoiceLines have a text and a cost.
My question is: How can I perform the following validations?
If the Invoice Status is not draft:
No InvoiceLines can be added to it
The va...
I've been migrating some of my mySQL queries to postgreSQL to use Heroku... most of my queries work fine, but I keep having a similar recurring error when I use group by:
ERROR: column "XYZ" must appear in the GROUP BY clause or be used in an aggregate function
Could someone could tell me what I'm doing wrong?
MySQL which works 100%...
hi all
I am deploying my rails app to a linux server and i have some of the rake tasks missing inlcuding rake gems:install and rake db
I am running rails 2.3.4 from GEM.
Does anyone know why this is?
How do i fix this ? can i update some how ?
thanks alot
richard moss
...
I tried adding a few gems to my Rails app using the config.gem instruction in environment.rb so that when the app gets deployed on a new system, the missing gems issue can be taken care of with rake gems:install
After adding the list of required gems that my app depends on, my app failed to start. If I remove the list of required gems f...
hi
I have ran gem install rails and am running 2.3.4
but i am missing some rake tasks like 'db' and 'gems'
if i run rake -T i get the following tasks. How can i get all the others ?
rake apache2 # Build Apache 2 module
rake clean # Remove compiled files
rake clobber # Remove all generated
files
rake default # Bu...
I'm in a databases course and the instructor wants us to develop an e-commerce app. She said we can use any framework we like, and now that we're halfway through the semester she decided that Rails does too much and wants me to explicitly write my SQL queries.
So, what I'd like to do is to write my own functions and add them to the mode...
I am new to rails so go easy on me. I have built a blog and I am attempting to add a "vote up" type feature to the /posts/index.html.erb page. Kind of like Facebooks's like feature. I have can successfully get the vote form to work. I have successfully been able to get the posts rendererd out through the <% @posts.each do |post| %> call....
I have the following form:
<% form_for(:tag, :url => {:action => "post_tag", :id => @photoID}) do |form| %>
<%= error_messages_for(:tag) %>
<% if @errors then %>
<%= @errors[0] %>
<% end %>
<p><%= form.select(:user_id, @userHash) %></p>
<p><%= form.hidden_field(:xpos) %></p>
<p><%= form.hidden_field(:ypos) %></p>
<p><%= ...
I am new to rails so go easy. I have built my first blog and would like to set it up such that in the <% post.each do |post| %> render of the posts, I would like it to work such that it only displays 10 posts and then has a link to view the next 10.
I am hoping this is an easy question. Let me know if you would like me to post any code...
I am new to rails so go easy. I have created a blog with the ability to "vote" on a post by using a feature much like Facebook's "like". I am not using any authentication but would like to restrict voting on a particular post by IP. That is, once someone votes for a post, they cannot vote again (unless they reset their router of course)....
I have an issue with manipulating large number of record objects of type ActiveRecord model(Records are extracted from a complex operation but from the same table) and I want to pass that object set around between controller actions. So I have couple of solutions but is wage about which way to choose. Simpler but uglier solution is to sa...