Rails upload form with carrierwave and polymorphic associations

stackoverflow.com - 2013-04-13 17:07:49 - Similar - Report/Block

I'm trying to wrap my head around using polymorphic associations to make file management less repetitive in a simple rails app. I'm using carrierwave to handle the file uploading. Here's what I have so far: app/uploaders/file_uploader.rb class FileUploader < CarrierWave::Uploader::Base def store_dir "uploads/#{model.class.to_s.underscor...

In Rails how do I handle multiple, polymorphic file uploads with jquery-file-upload and CarrierWave?

stackoverflow.com - 2011-04-15 19:52:35 - Similar - Report/Block

In my project I currently have different models (Project, Message, etc) that: has_many :assets, :as => :attachable, :dependent => :destroy Each Asset is basically a model with a CarrierWave file. Normally I would just use accepted_nested_attributes on the parent model (Project, Message, etc) and have the file upload fields listed in...

Polymorphic models like rails in Django? [closed]

stackoverflow.com - 2011-03-29 16:31:20 - Similar - Report/Block

rails models by declare :polymorphic => true i could using that as Polymorphic model.. But how can i create polymorphic model in Django I know it's not just simple like doing in rails but i need some introduction for doing this in Django...

Unicorn + Rails + Large Uploads

stackoverflow.com - 2012-03-06 23:05:07 - Similar - Report/Block

I'm trying to allow for large uploads when running Unicorn on Heroku with Rails but I've realised that any large uploads might take longer than the timeout period for a Unicorn worker. This will mean (I've seen this happen) that the Unicorn master process will kill the worker uploading the large file and the request will timeout (with a 5...

Rendering an HTML file in rails

stackoverflow.com - 2013-03-04 07:41:53 - Similar - Report/Block

I am using CarrierWave to upload static HTML templates to certain user profiles on my webpage. I am trying to render the HTML file on the user's home page once they log in. The Path for the HTML file after uploading is: /uploads/profile/curation/8/User_Content .html I'm new to rails and I thought I'd just be able to <%= render /uploads/pro...

Routing Polymorphic Requests Rails

stackoverflow.com - 2013-04-05 04:06:49 - Similar - Report/Block

In rails 3, I have several polymorphic models such as Image and Comment , so my question is, When someone makes a request to Create/Update/Destroy a polymorphic object, should the request go to a single controller for the polymorphic object CommentController , or should the request be routed to the controller of the polymorphic accessor...

Should we use the abstracted rails polymorphic migration syntax?

stackoverflow.com - 2012-03-30 19:46:58 - Similar - Report/Block

There are two ways to write a polymorphic migration in Rails. Generally, I've done this: class CreateFeatures < ActiveRecord::Migration def change create_table :features do |t| t.integer :featureable_id t.string :featurable_type t.timestamps end end However, we can also do this: class CreateFeatures <...

Rails 3 paperclip vs carrierwave vs dragonfly vs attachment_fu

stackoverflow.com - 2011-09-14 18:28:19 - Similar - Report/Block

I'm working on upgrading a Rails 2.3.11, Ruby 1.9.2 app to Rails 3.0.10, and attachment_fu no longer works. I'm looking at changing to paperclip, carrierwave, or dragonfly for file uploads, or maybe a Rails 3 compatible, maintained version of attachment_fu. Which of these options would be the best to use in terms of performance, how well...

What's the best way to determine whether a polymorphic join table is appropriate

stackoverflow.com - 2012-02-25 11:21:11 - Similar - Report/Block

I'm trying to figure out whether I should make a polymorphic join table for a many to many relationship or whether I should make multiple join tables. For things like comments, I always use a polymorphic join table. For relationships between users, like following on Twitter, I don't use polymorphic join tables. This is just out of habit.

Multiple file upload with php and html

stackoverflow.com - 2013-02-27 08:59:16 - Similar - Report/Block

I'm having trouble implementing this script for multiple file uploads. The user needs to specify exactly which folder (Course Code) to put the file in hence the $_POST function Here is my HTML Choose Course Code: ACC 100 ACC 406 ECN 104 ECN 204 FIN 300 GMS 200 ITM 100 ITM 301 ITM 305 ITM 330 ITM 350 ITM 407 ITM 500 ITM 501 ITM 505 ITM 600...

How to handle bi-directional references with polymorphic types and JSON?

stackoverflow.com - 2012-03-02 23:45:05 - Similar - Report/Block

Summary: Is there any way for Jackson to handle bidirectional references with polymorphic types where @JsonTypeInfo is also used? A note at the bottom of this page states no but it was written in 2010 and applied to Jackson v1.6.0 so I'm hoping maybe something has changed or someone can suggest an alternative approach Background: I'm ge...

Gem not available in Rails app but works fine in Rails console (IMGKit)

stackoverflow.com - 2012-06-30 04:01:43 - Similar - Report/Block

Trying to create an IMGKit instance in one of my Rails controllers: def wkhtmltoimage ... kit = IMGKit.new("http://#{request.host_with_p ort}/?auth_token=" + token) img = kit.to_img(:jpg) file = kit.to_file(Rails.root + "public/uploads/testimage.jpg") ... When I load the page, I get this: NameError in PagesController#wkhtmltoimage uni...

evolveStar Join

Examples and advices on combining a Polymorphic Association and a Single Table Inheritance

stackoverflow.com - 2011-05-05 09:56:57 - Similar - Report/Block

I am using Ruby on Rails 3 and I would like to know a real world example (or more) and some advice on when I should\can\must use the combination of a Polymorphic Association and a Single Table Inheritance as implemented here at the Polymorphic Association paragraph...

Model an undirected graph in Rails?

stackoverflow.com - 2011-11-02 05:45:45 - Similar - Report/Block

Importing the language of graph databases , understand nodes represented by circles edges represented by arrows ), and properties metadata of nodes / edges The graphic (courtesy of wikipedia) describes a directed graph What's the best way to model an undirected graph in Rails? That is to say, a graph where all edges are reciprocal ( as i...

Rails fails to install

stackoverflow.com - 2012-04-29 23:28:44 - Similar - Report/Block

I'm trying to install rails on a Mac but am getting some strange errors: sudo gem install rails Successfully installed rails-3.2.3 1 gem installed Installing ri documentation for rails-3.2.3... file 'lib' not found Installing RDoc documentation for rails-3.2.3... file 'lib' not found rails --version Rails is not currently installed...

How do I install multiple versions of Rails using just Bundler, without using RVM gemsets?

stackoverflow.com - 2012-03-19 14:34:57 - Similar - Report/Block

USE CASE: I have two rails projects, called ProjectA and ProjectB. ProjectA is developed using one version of rails ("RailsA"), whereas ProjectB uses a different version ("RailsB"). How do I manage having both versions installed? THE GEMSETS APPROACH: When I first started with Rails development, I used . In addition to supporting m...

Rails 3: Devise user with Polymorphic association for different user profiles

stackoverflow.com - 2013-03-01 19:52:36 - Similar - Report/Block

I have a Rails app. I installed Devise. I want to have a polymorphic association between the User model and the different profiles, for example: Student and Mentor. This is what I'm trying to do: have a student registration page with the regular devise fields such as: email password password_confirmation . But I also want to have fields s...

Multiple image resize and upload with description

stackoverflow.com - 2012-05-22 00:43:41 - Similar - Report/Block

I'm looking for a way to upload multiple images with description. Users will be uploading 1-10 images of quite a large size from cameras so it's better if the images get resized before upload. Requirements: browser compatible (including mobile browsers and IE), can rely on JavaScript (jQuery) multiple files either as selection of multiple...

Polymorphic has_many: through in rails

stackoverflow.com - 2012-03-27 19:37:42 - Similar - Report/Block

I have a tags model that I'd like to be polymorphic, but I don't want five records for a tag of "video" for example, I want to create the tag once and be able to use it on a variety of models. I've ready some of the questions here about doing that, but I'm not quite getting how to make it work. So I've got: class Tag < ActiveRecord::Ba...

What are best practices to handle database data in 'test' mode?

stackoverflow.com - 2012-03-19 12:28:52 - Similar - Report/Block

I am using Ruby on Rails 3.2.2, cucumber-rails-1.3.0, rspec-rails-2.8.1 and capybara-1.1.2. I have this problem but I started thinking that maybe I'm doing something wrong... mostly about seeding data in the database for testing purposes. Specifically, my issue is related to how to properly manage data in the database when I have to te...

Hacking an uploader to handle large files using jQuery

stackoverflow.com - 2012-07-21 09:40:11 - Similar - Report/Block

Are there ways where I can use jQuery to improve the performance of a file uploader? There's a system where I am trying to hack to make the uploading process better. I am just doing some frontend override as I don't have permission to their server files. The current uploader looks something like this: <ul> <li> <input type=...

How do I capture Uploaded files from HTML 5 multiple file input tags

stackoverflow.com - 2012-03-04 03:46:36 - Similar - Report/Block

If I have an input tag like this: <input type="file" multiple="multiple" name="file1" /> and select multiple files, the browser creates multiple files with the same 'file1' name tag. It's like a multiple selection of a listbox. So how do I capture this in ASP.NET using the Request.Files collection? The Request.Files.AllKeys collecti...

Rails + processing.js - where to put .pde files?

stackoverflow.com - 2012-03-31 03:40:04 - Similar - Report/Block

I am using Rails 3.2 with asset pipeline. I am trying to add some processing.js to the app, the processing.js file is found fine, but the .pde file gives the error: Uncaught Processing.js: Unable to load pjs sketch files: graphBuilder.pde ==> Invalid XHR status 404 The folder structure is usual: RailsApp/app/assets/javascripts/pjs/grap ...

yml file exists but rails server and passenger complains that it doesn't

stackoverflow.com - 2012-08-07 22:26:27 - Similar - Report/Block

I've been following the railscast #85 by Ryan Bates at this link regarding YAML config files and I've ran into a problem that I can't find an answer to. I am using Ruby 1.9.3p194 through RVM and Rails 3.2.6. In my applications.rb, I have require 'yaml' APP_CONFIG = YAML.load_file("#{Rails.root}/config/con fig.yml")[Rails.env] I put the fo...

polymorphic relationships and interfaces/abstract classes/protocols

stackoverflow.com - 2012-02-25 04:01:19 - Similar - Report/Block

I have a polymorphic model Comments that I associate with almost every other model. I have comments index page where I use the title of the model, which I call commentable What is the best way to ensure that the commentable model has a method or attribute called :title In Objective-C I would define a protocol and in other languages I wo...

serialize object (really Mongoid document) to any binary format in Rails

stackoverflow.com - 2013-03-21 11:09:43 - Similar - Report/Block

I implementing async process which handle documents from mongodb database. I have something like master thread which check if new objects exist in collection and then put it to the queue (RabbitMQ), and a several handlers (currently one) which handle messages from the queue. So when I put message to the queue I need to serialize it to bin...

Nested form in edit view

stackoverflow.com - 2013-04-30 19:36:14 - Similar - Report/Block

I have polymorphic model Images and Post Account etc. models: class Image < ActiveRecord::Base ... belongs_to :imageable, polymorphic: true ... end class Post < ActiveRecord::Base ... has_many :images, as: :imageable accepts_nested_attributes_for :images end Controller: class PostsController < ApplicationController ... def new...

Why aren't my compile guards preventing multiple definition inclusions?

stackoverflow.com - 2008-10-30 10:52:40 - Similar - Report/Block

I have a header file x.h which is included by more than one *.c source files. This header file has some structure variables defined. I have put multiple inclusion prevention guard at the beginning of the header file as: #ifndef X_H #define X_H //header file declarations and definitons. #endif//X_H On building I get linker errors related...

Rails - Multiple file upload form with additional input for each file

stackoverflow.com - 2013-03-20 11:24:51 - Similar - Report/Block

I'm working on an app at work where users can upload files to a project. Right now I'm using paperclip, and all of the file info (name, file type, etc.) is recorded properly. The problem I'm having is that the users need to assign a category to each file. What is the best approach to implement something like this? I'm on my phone right no...

Rails URL Access

stackoverflow.com - 2012-07-10 18:01:59 - Similar - Report/Block

I'm new to Ruby on Rails, so please pardon my ignorance. My issue is that I cannot access the Rails project from the browser. I assume it has something to do with the Rails config, but I am having no luck so far. State of the Project I have existing logic (controllers, models, migrations, ...). If I leave index.html in place, I see the Ra...

Door Handle Mini Pack (Sound Packs)

audiojungle.net - 2013-03-31 21:26:14 - Similar - Report/Block

Small package, consisting of 11 high-quality variations turn the doorknob. Stereo samples can be used as sound mechanics, old technology, rusty machinery. Door Handle 1 – 0:01 Door Handle 2 – 0:01 Door Handle 3 – 0:01 Door Handle 4 – 0:01 Door Handle 5 – 0:01 Door Handle 6 – 0:01 Door Handle 7 – 0:01 Door Handle 8 – 0:01 Door Handle 9 – 0...

CodeIgniter upload png image type not working?

stackoverflow.com - 2012-02-28 05:36:49 - Similar - Report/Block

what my problem is why my code unable to store .png file in database and uploads folder, but other than file like .jpg, .gif I successfully insert to database and uploads folder, I had include $config['allowed_types'] = 'png' as well, in addition, here is what I var_dump out the error message "The filetype you are attempting to upload is...

Devise user with Polymorphic association for different user profiles

stackoverflow.com - 2013-03-01 19:52:36 - Similar - Report/Block

I have a Rails app. I installed Devise. I want to have a polymorphic association between the User model and the different profiles, for example: Student and Mentor. This is what I'm trying to do: have a student registration page with the regular devise fields such as: email password password_confirmation . But I also want to have fields s...

Comment on Complex Rails Forms with Nested Attributes by Brad

rubysource.com - 2013-02-17 23:54:15 - Similar - Report/Block

Try Ryan’s updated RailsCast on NestedAttributes, which does exactly that (create a multiple choice quiz): http://railscasts.com/episodes/196-neste d-model-form-revised (highly worth paying the $9), or if you want to watch the older one, which should mostly work on Rails 3.x, you can try: http://railscasts.com/episodes/196-neste d-model-fo...

Rails 3: Ruby 1.9.2: does it need /usr/bin/ruby1.8?

stackoverflow.com - 2010-12-16 20:19:28 - Similar - Report/Block

I am trying to get the Rails tutorial by Michael Hartl going. I spent a lot of time fighting various libraries. So I removed all ruby software from my Ubuntu 10.4 system. Then I installed Ruby 1.9.2. $ ruby -v ruby 1.9.2dev (2010-07-02) [i486-linux] So far so good. Then I did sudo gem install rails After a long time, it finished the i...

weird failure with "PhpThumbFactory"

stackoverflow.com - 2011-03-07 11:17:56 - Similar - Report/Block

I'm using the PhpThumbFactory -library inside of my Zend-Framework application. And it seems to execute (!?) the generated image file as PHP. Error: [07-Mar-2011 11:20:20] PHP Warning: Unexpected character in input: '' (ASCII=16) state=0 in path\uploads\thumbs\3.jpg on line 52 [07-Mar-2011 11:20:20] PHP Parse error: syntax error, une...

Rails/Memcached - MemCacheError (end of file reached): end of file reached

stackoverflow.com - 2012-04-04 21:38:58 - Similar - Report/Block

My Rails app is using a Memcached server. from some reason, from time to time, I'm getting MemCacheError (end of file reached): end of file reached in my Rails application logs. any ideas why?...

Understanding jQuery Rails Gem and rails.js

stackoverflow.com - 2012-03-22 10:09:19 - Similar - Report/Block

I'm trying to solve the book "Rails 3 in Action" where the authors have used the following code to add a link that uses ajax to generate a new file field. I'm having difficulty in understanding in how this works and what is the equivalent javascript(or jQuery) which can be functionally equivalent to understand it better: <%= link_to "...

How to boot multiple Rails apps on Apache2 with a shared Passenger gem?

stackoverflow.com - 2012-05-02 23:32:30 - Similar - Report/Block

I'm attempting to configure Apache V2 to handle two Rails (3.2.2) applications at the same time using VirtualHost directives. I'm doing this on a local laptop. (Ubuntu, Ruby 1.9.2, and Passenger 3.0.12.) Used the deployment instructions in "Agile Web Development .... Rails", V4. The first simple application booted up w/o problem. I then c...

упорядочить вывод картинок - PHP для начинающих

cyberforum.ru - 2013-05-15 13:20:58 - Similar - Report/Block

Нужно сделать так чтобы картинки шли в нужном порядке , сейчас же в таком коде, они идут хаотически Код: if ($handle = opendir('newpic/'.$id)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo " closedir($handle); Название картинок во всех статьях идут такими Name001.jpg Name002.jpg Name003.jp...


Fill out the form you see below. Registration is free, fast and simple.
If you are already registered, sign in page login.

Web Site :
Required Field
First Name :
Required Field
Last Name :
Required Field
Email :
Required Field
Sex :
Required Field

evolveStar.com is free for ever !

evolveStar.com provides a search engine that allows you to gather information to write their own blog.

evolveStar.com enhances the sources displaying the logo of the site.

If you want to remove your site or you believe a site listed infringes copyright, please report it to: info@evolvestar.com

Specifies the subject copyright violation and the url of the page

evolveStar.com respecting the law DMCA (Digital Millennium Copyright Act) will immediately remove whatever its merits.

Next will be effectual and relevant checks.

Who We Are Partner Advertising Contacts Privacy terms Help & FAQ

© Copyright 2010-2017 Fabrizio Fichera. All rights reserved.