Displaying 20 results from an estimated 200 matches similar to: "Rails 3.1 Optional Routes"
2008 Jan 10
0
BUG? has_many :through makes funny queries
So I have this structure.
class Gallery < ActiveRecord::Base
belongs_to :owner, :polymorphic => true
has_many :folders, :order => ''slug'', :dependent => :destroy
class Folder < ActiveRecord::Base
has_many :photos, :dependent => :destroy, :conditions => "parent_id IS
NULL"
belongs_to :gallery
class User < ActiveRecord::Base
has_one
2010 Sep 08
2
subbing a string vector for another string vector
I have a data frame with two columns:
image pattern
1 http://$IMAGE_ID$ www.url.com/image.jpg
2 $IMAGE_ID$ http://www.blah.com/image.gif
...
I want to replace "$IMAGE_ID$" with the corresponding entry in the pattern
column such that the result would appear as follows:
url
http://www.url.com/image.jpg
2006 Sep 03
7
using polymorphic associations with acts_as_list
This is what I have
class Photo < ActiveRecord::Base
belongs_to :image, :polymorphic => true
acts_as_list :scope => image
end
class Place < ActiveRecord::Base
has_many :photos, :as => :image
end
class Child < ActiveRecord::Base
has_many :photos, :as => :image
end
I want to be able to reorder the images. What I need is for the
position of the photos to be set
2006 Jan 14
0
Compact db design a bad idea?
Hi,
I have tried two db designs and both can work but I wonder which one
the Rails Gurus would go with. This is a general db design question
that has cropped up in a few situation. Here is the example I''ve been
working on.
In an online store, categories has_and_belongs_to_many images and
products has_and_belongs_to_many images. The db has the basic three
tables
categories
- id
- name
2006 Mar 20
1
FileColumn question
Can someone please help me with this.
I have an Images table :-
create table images (
id integer unsigned not null auto_increment primary key,
image varchar(200) not null default ''''
)ENGINE=InnoDB default CHARSET=latin1;
And a car table :-
create table cars (
id integer unsigned not null auto_increment primary key,
user_id integer unsigned not null,
title varchar(100) not
2005 Dec 23
4
OO model style: inheritance
Hi everybody
I am totally new to rails and I am trying to start a
tiny project to get familiar with rails. But I already
got my first problem and I would be happy if somebody
could point me in the best and cleanest direction.
I am trying to develop a small gallery app. Since I
would like to add more features in future I am trying
to design a clean OO architecture of my models:
The base object
2006 May 11
4
modelling data to specify user access
Hello, this is my second Rails app, and the first one I did had simple
data mapping. This time I am building a site for a photographer, and
they want to upload photos, and create galleries that only certain
clients can log in and have access to. There will be multiple
galleries, and the access to them will vary depending on how the admin
assigns it to each client. There is also a porftolio
2012 May 01
0
Engine: access to url_helpers otside view/controller
I use Engine.
How to get access to url_helpers, such as <name>_path or _<name>_url, in
a separate class? In application it simple:
Rails.application.routes.url_helpers.<name>_path
But how to get access to url_helpers in Engine? When I use
Rails.application.routes.url_helpers.root_path, then I get ''/'', root of
Application. Other helpers for Engine
2008 Jan 22
1
getting multiple select to work: options_for_select
Hi,
<%= select_tag ''image_id'', options_for_select(Image.find(:all) {|
an_image| [ an_image.name, an_image.id ] }), :multiple => true %></p>
* I am in a view, and I am trying to search the image table and make a
multiple select box with each image''s name.
* Right now it is working, but I see this:
---------------------------------------------
2006 Jul 18
0
another 2 newbie questions
Hey all,
Ok I have three tables:
Images(id,name,dirid) #dirid is a foreign key to Album.url, the path
to the image
Albums(id,url)
Tags(id,name)
ImagesTags(image_id,tag_id)
I have a HABTM relation for tags and images and a belongs_to/has_many
relation for albums and images.
Now in my views/tag/show.rhtml I have this:
<% for album in @albums %>
<% for image in @images %>
<% if
2006 May 16
0
strange MySQL data populating
I am getting weird data when trying to use HABTM.
I have a Images table with columns id, title, and file.
I have a Categories table with columns id, name.
I have a join table for them with image_id, and category_id
when I do @images.inspect I get:
[#"image 1", "id"=>"52", "portrait"=>"0",
2007 Oct 18
0
Very strange - major leak, crashed mongrel
I made what I think is a small change yet the change in my app was
disastrous - cpu spun, memory went out of control, and mongrel crashed
within seconds.
I have a controller which takes a param for submission_id . Submissions
have 1 or more reviews, and reviews each have one image. There may be more
than one image per submission.
The view (and partial) code does some very intense things, like
2006 Jul 17
6
3 newbie questions
hey all,
I have 3 tables like this:
Images (id,name)
Tags (id,name)
ImagesTags(imageid,tagid)
in my image model I do a "has_and_belongs_to_many :tags" but to make
it work I need to rename ImagesTags(imageid,tagid) to
Images_Tags(image_id,tag_id). My question is that given that I can''t
rename the table, is there any way to make it work with the original
names?
Second question:
2010 Sep 01
0
Error on update_attributes with HABTM relationship
Hope someone can tell me what''s up, because this has me baffled.
I have an Image model, and a Provider model. Both are defined as
"has_and_belongs_to_many" relating to each other. In my image form
partial, I have a bit of AJAX generating the provider_ids array
dynamically from a provider AJAX search on the same page.
So for example, each time I click on a provider name that
2013 Jul 18
0
url_helpers in /lib
Hi, I''m trying to generate some static feeds using a script in /lib that I
will later call from a sidekiq worker and I need to access the URL helpers
from my library, how can I do it?
What I tried so far is including Rails.application.routes.url_helpers in my
class but it doesn''t seem to work. I''ve also tried to follow this blog
post
2006 Apr 22
9
one to many question
1. A category has parent categories.
2. A product is in many categories and a category has many products.
3. Products and category both have images in the same image table. ie. a
product and / or category could have multiple images.<=== my question is
related to this
So among other things I presume I have to do the following:
class Category < ActiveRecord:Base
#...
2007 Nov 12
0
3 commits - libswfdec/swfdec_player.c test/trace
libswfdec/swfdec_player.c | 18 +--
test/trace/loadvars-decode-5.swf |binary
test/trace/loadvars-decode-5.swf.trace | 182 +++++++++++++++++++++++++++++++++
test/trace/loadvars-decode-6.swf |binary
test/trace/loadvars-decode-6.swf.trace | 182 +++++++++++++++++++++++++++++++++
test/trace/loadvars-decode-7.swf |binary
test/trace/loadvars-decode-7.swf.trace |
2018 Mar 19
1
[LEARNING OUTCOME] Wi-Fi WPA Hacking Tool is Totally Useless on New Wireless Routers
Hi,
I am sharing my learning outcomes.
Recently I downloaded Kali Linux 64-bit Version 2018.1 and ran it on
my HP laptop with the integrated Intel Dual Band Wireless-AC 8260
Wireless Network Card.
I wanted to test if I could hack the Wi-Fi WPA password on Ruckus R700
Access Point (AP) and the Aztech DSL8900GR(AC) Wireless Router. So I
started using the Reaver WPA cracking tool.
I understand
2006 Jun 08
5
update only the join table in a HABTM - how?
I have a photographers app that requires giving access to galleries for
users. in one part, I want to be able to define gallery access for a
user seperate from updating any of the user info. I have this function:
def edit_access
@user = User.find(params[:id])
@user.galleries = Gallery.find(params[:gallery_ids]) if
params[:gallery_ids]
if @user.update_attributes(params[:user])
2009 Feb 03
1
SAS language to R :interview
Dear List,
Please find a frank interview with Phil Rack, creator of Bridge to R (
from both SAS and WPS interfaces).
For those unaware of WPS- it is basically a SAS language compiler
(read SAS code,writes SAS code,Reads and writes SAS datasets) ,priced
at 660 $ a licence ( or estimated 10 times cheaper than Base SAS.
The UK based WPC held, WPS doesnt have advanced statistical facilities
like