[Rails] Sunspot Solr specialized search
Hello all, I have a question that I've searched for a bit but can't really find anything. I might not be searching on the right things. I have Sunspot/solr working great and now I want to start using it to speed up Backbone.js queries. I have it currently working with straight Rails. == CONTROLLER def members @group = Group.find(params[:group_id]) @members = @group.members.nil? ? nil : @group.members.reject { |user| !user.active? } respond_with(@members.to_json end MODEL (Group) def members @members ||= roles.members.collect { |role| role.user }.compact unless roles.members.empty? end == Basically I'm trying to figure out a way to return :members method's results more quickly. I know with sunspot/solr you can index methods, but this helps with searching on a member get getting the group. I basically need the opposite. What makes this more complicated is that Group has_many :users, :through = :roles as a polymorphic relationship. Roles table === user_id = user's id object_type = object for (Group, Forum, etc) object_id = id of object (Group, Forum, etc) === I know its complicated but it really needs to be this way. If anyone has any ideas I would greatly appreciate it. Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Thinking_sphinx and Delayed Delta issue
Hello, I'm having a very annoying problem. I'm using Delayed Delta with thinking_sphinx and it has worked in the past on this same environment and suddenly months later without touching it, I restarted these processes and Delayed_delta has decided to continue to shut down. I have googled like crazy and find nothing. Can anyone make sense of this and help me figure out what I need to do to get this working again? Thank you in advance. Below is the ridiculous out put I get when I start the delayed_delta: = # Logfile created on Wed Feb 08 12:33:11 -0800 2012 by logger.rb *** below you find the most recent exception thrown, this will be likely (but not certainly) the exception that made the application exit abnormally *** #LoadError: no such file to load -- fast_xs *** below you find all exception objects found in memory, some of them may have been thrown in your application, others may just be in memory because they are standard exceptions *** #NoMemoryError: failed to allocate memory #SystemStackError: stack level too deep #fatal: exception reentered #ActiveRecord::AdapterNotSpecified: development database is not configured #Errno::EACCES: Permission denied - /path/to/releases/20120208194704/log/development.log #LoadError: no such file to load -- fast_xs I, [2012-02-08T12:33:38.035071 #10229] INFO -- : *** below you find the most recent exception thrown, this will be likely (but not certainly) the exception that made the application exit abnormally *** E, [2012-02-08T12:33:38.035188 #10229] ERROR -- : You have already activated daemons 1.1.5, but your Gemfile requires daemons 1.1.0. Consider using bundle exec. (Gem::LoadError) /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:31:in `setup' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:17:in `setup' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.12/lib/bundler.rb:107:in `setup' /path/to/releases/20120208194704/config/boot.rb:8 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /path/to/releases/20120208194704/config/application.rb:1 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' ./config/environment.rb:2 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' script/delayed_delta:16 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/daemons-1.1.5/lib/daemons/application.rb:249:in `call' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/daemons-1.1.5/lib/daemons/application.rb:249:in `start_proc' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/daemons-1.1.5/lib/daemons/daemonize.rb:200:in `call' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/daemons-1.1.5/lib/daemons/daemonize.rb:200:in `call_as_daemon' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/daemons-1.1.5/lib/daemons/application.rb:253:in `start_proc' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/daemons-1.1.5/lib/daemons/application.rb:293:in `start' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/daemons-1.1.5/lib/daemons/controller.rb:83:in `run' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/daemons-1.1.5/lib/daemons.rb:195:in `run_proc' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/daemons-1.1.5/lib/daemons/cmdline.rb:109:in `call' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/daemons-1.1.5/lib/daemons/cmdline.rb:109:in `catch_exceptions' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/daemons-1.1.5/lib/daemons.rb:194:in `run_proc' script/delayed_delta:14 I, [2012-02-08T12:33:38.035249 #10229] INFO -- : *** below you find all exception objects found in memory, some of them may have been thrown in your application, others may just be in memory because they are standard exceptions *** E, [2012-02-08T12:33:38.035471 #10229] ERROR -- : failed to allocate memory (NoMemoryError) E, [2012-02-08T12:33:38.035536 #10229] ERROR -- : stack level too deep (SystemStackError) E, [2012-02-08T12:33:38.035588 #10229] ERROR -- : exception reentered (fatal) E, [2012-02-08T12:33:38.037973 #10229] ERROR -- : no such file to load -- bundler (LoadError)
[Rails] Fields_for adding html (text) for hidden field
Hello all, I'm getting this weird 'input name value='2' type='hidden' /' text printed out in my form. See attached image. I've spent too much time trying to figure it out already and it's not going to stop me from moving on for now. As you can see it's still very early on. I'm using nested_attributes_for and fields_for: (also HAML) = = form_for @user, :url = {:action = 'update'} do |f| # removed fields here = f.fields_for :roles do |r| - unless r.object.for_object.nil? = r.label :role, r.object.for_object.name = r.select :role, Role::Roles.options_for_select = f.submit Update User = Any thoughts would be appreciated. Thank you Attachments: http://www.ruby-forum.com/attachment/6926/nested_fields_issue.jpg -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Polymorphic and standard association issue
Hello all, I'm having a strange issue with a model that belongs_to two other models. The one association is polymorphic and the other is normal. class Role ActiveRecord::Base belongs_to :user belongs_to :permission, :polymorphic = true end class User ActiveRecord::Base has_many :roles has_many :programs, :through = :roles end class Program ActiveRecord::Base has_many :roles, :as = :permissions has_many :users, :through = :roles end But for some reason... @user = User.find(1) @user.roles Role.create({:role = 100, :user_id = @user.id}) Rails.logger.info @user.roles.inspect ...returns nothing. I'm very confused here. My roles table has --- | id | user_id | permission_id | permission_type | --- | 1 | 1 | NULL | NULL| --- If anyone can help me out I'd greatly appreciate it. Environment: -- Ruby: REE Rails: 3.1.2 Passenger Thank you, Sparkmasterflex -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Polymorphic and standard association issue
I'm sorry to anyone who has spent any time on this at all. I hope since I found the problem so quickly after posting this no one has. The issue was that I was attempting to find all roles for the currently logged in user. While they are creating a new User. Basically @user was set in the controller as User.new and I needed to call current_user.roles instead. Thank you listening to me and sorry again -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Paperclip saving/retrieving files above public/
Does anyone have any ideas on this? Please I'm still desperate for an answer -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Rails and CKEditor
Leonardo, That's exactly what it is. Thanks! I commented out the before_filter that handles devises authentication and the app was able to find the route as it should. I read this somewhere too, I believe with authlogic or maybe it was devise. Any ideas on a work around? I'm concerned about allowing this action go without user authentication for security reasons... Thanks again -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Rails and CKEditor
Ok, I found this post: http://stackoverflow.com/questions/6128495/devise-being-logged-out-on-post-to-different-route and it showed me that the 'protect_from_forgery' method is the culprit here and commenting it out makes this functionality work how it is supposed to. Again it makes me nervous to leave this method out. Does anyone know of a way to fix this or work around the 'protect_from_forgery' for just this :upload action? I'm not really finding anything on fixing this issue via google -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Rails and CKEditor
Thanks for the replies! I looked into the el_finder, but this is using jQuery and I'm building this out in prototype. If I use that gem would that add any real bloat to my application? I have always been weary of having too many calls to javascript files and having two libraries loading seems wrongish... I tried creating a route for uploading. I simply created a 'match /upload = controller#action, :via = :post' But this is causing all kinds of issues with Devise gem that is handling my login/out. Every time I click 'send to server' it logs me out of my application and doesn't even hit my :action that it is supposed to be getting to. Any thoughts? Again thank you both for helping me thus far. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Rails and CKEditor
Has anyone used CKEditor successfully with Rails? Specifically the file/image upload? I have the ckeditor working rather well but this aspect. I have the upload tab on the popup and it allows the user to browse their computer for an image and then click Send to Server This is where it breaks. I get a routing error No route matches /uploader/upload.php which actually makes sense b/c I can't find that directory and/or file within the ckeditor files. Do I need to download these separately? or Do I need to create this upload functionality myself? Either way is fine by me but I just don't want to spend time working on one solution if there is an easier or already 'in-place' solution that I'm missing. Any help would be appreciated. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Paperclip saving/retrieving files above public/
Anyone have anything they can add? Any help at this point would be appreciated. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Paperclip saving/retrieving files above public/
Ok that makes sense. Thank you. Though I'm still not getting this to work. Where do I go from here? I created the images_controller and created routes for them. I looked into this and saw some one else doing this in their controller to handle 'documents' (pdfs, jpgs, pngs, etc) def show @image = Image.find(params[:id]) respond_to do |format| @imgstyle = params[:style].blank? ? # ERROR B?C imgstyle == nil params[:format].blank? ? nil : params[:format].to_sym : params[:style] mime_type = case @imgstyle when :thumb, :preview then jpeg when :original then tiff end # render show action format.html {} # send original for download format.original { |format| send_file @image.path(:original), :filename = @image.filename } # used with image_tag helper to send file to the browser format.any { |format| send_file @image.path(@imgstyle), :type = image/#{mime_type}, :filename = @image.filename, :disposition = 'inline' } end end -- and it makes sense, but how do I get my show action for Character (characters/show.html.haml) to contact the images_controller for the show action? Again thank you for your help. Definitely pointed my in the right direction. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Paperclip saving/retrieving files above public/
Hello all, I'm quite baffled/agitated by this. I'm using paperclip to allow upload of images to my application. This is working fine, it's saving the the images exactly where its supposed to and it's saving the image objects as its supposed to. The problem is that I can't display these images in the browser. I've had this issue in a couple other applications I've made and just got around it by having paperclip save to the public folder and pull from there to display the desired image. But I feel as though I should get this sorted out. So here goes: My image model (paperclip) - class Image ActiveRecord::Base class ContentType IMAGES = [image/png, image/x-png, image/jpg, image/jpeg, image/pjpeg, image/gif, image/bmp, image/tiff] GIF = [image/gif] def self.allowed_types IMAGES + GIF end end belongs_to :attachable, :polymorphic = true has_attached_file :attachment, :path = :rails_root/uploaded/:attachable_type/:attachable_id/:id_:style.:extension, :url = /images/:id_:style.:extension, :styles= lambda { |attachment| ContentType::IMAGES.include?(attachment.instance_read(:content_type)) ? { :thumb = [80x80, :png], :preview = [400x400, :png], :large = [1000x1000, :png] } : ContentType::GIF.include?(attachment.instance_read(:content_type)) ? {:thumb = [80x80, :png], :preview = [400x400, :gif], :large = [1000x1000, :gif] } : {} }, :default_style = :preview validates_attachment_size :attachment, :in = 1.kilobytes..24.megabytes validates_attachment_content_type :attachment, :content_type = ContentType.allowed_types ... code omitted end - I have included this line in my 'config/environments/development.rb' file config.action_dispatch.x_sendfile_header = X-Sendfile and I have the mod_xsendfile.x.x.so in my vhost: VirtualHost *:80 ServerName myapp.local DocumentRoot /Users/username/Sites/myapp/public RackEnv development XSendFile on #XSendFileAllowAbove on XSendFilePath /Users/username/Sites/myapp Directory /Users/username/Sites/myapp/public Order allow,deny Allow from all /Directory /VirtualHost When I print out the image.url and the image.path I get: /images/2_preview.png?1315164150 /Users/username/Sites/myapp/uploaded/avatars/1/2_preview.png Any help here would be greatly appreciated. I'm at a loss as to how this is not working. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Nokogiri gem issues
Just an update... I removed older versions of libxml2 and libxslt and reinstalled them from the source and it appears to be working. Thank you for all your help, again -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Nokogiri gem issues
Hello all, I recently was pointed towards the Nokogiri gem recently to find all html elements with a particular class, rather than attempting my own regular expression. (Thanks John-John Tedro and Hassan Schroeder) It works perfectly on my local machine, (Lion OS X and passenger), but when I deployed it to my server (Centos 5.5 and passenger) Nokogiri seems to not grab all the elements of the html file. Here is my method: = def find_editable code = Nokogiri::HTML(open(source_code(FtpAction::DOWNLOAD))) # source_code() method returns a location of a file within the app Rails.logger.info = code Rails.logger.info code.inspect elements = [] num = 0 code.css('.my-class').each do |el| # I tried using xpath, but was not able to get it to grab elements w/ 'class=my-class icon' # only 'class=my-class' attrs = [] el.attributes.each { |attr| attrs {attr[0] = attr[1].value } } elements {:element = el.name, :attributes = attrs, :content = el.content, :count = num+=1 } end Rails.logger.info elements Rails.logger.info elements.inspect elements # array return of hash built above, containing: # name (html tag) # attributes (classes and ids and anything else) # content actual text within element Hello World! end == Below is the output from the log files. You don't really need to go through all of the local output. The whole .html file is being parsed. If anyone has any idea why Nokogiri is not working on my server but would be locally, I would appreciate any help you can provide. Also I did check that the full .html file is there on the server and using File.open do |file| printed out the full file for me. Thank you in advance. Output from Rails.logger.info: -- Server (Centos 5.5) = code #Nokogiri::HTML::Document:0x5d14890 name=document children=[#Nokogiri::XML::DTD:0x5d14624 name=html] elements [] Locally (Lion OS X) = code #Nokogiri::HTML::Document:0x81f508d0 name=document children=[#Nokogiri::XML::DTD:0x81f4fd2c name=html, #Nokogiri::XML::Element:0x81f4fcb4 name=html attributes=[#Nokogiri::XML::Attr:0x81f4b5b0 name=lang value=en] children=[#Nokogiri::XML::Element:0x81f4aa84 name=head children=[#Nokogiri::XML::Element:0x81f4a3b8 name=meta attributes=[#Nokogiri::XML::Attr:0x81f4a0fc name=charset value=utf-8], #Nokogiri::XML::Element:0x81f4a264 name=meta attributes=[#Nokogiri::XML::Attr:0x81f49918 name=http-equiv value=X-UA-Compatible, #Nokogiri::XML::Attr:0x81f49904 name=content value=IE=edge,chrome=1], #Nokogiri::XML::Element:0x81f499a4 name=title children=[#Nokogiri::XML::Text:0x81f47e4c Mut8 Test Site], #Nokogiri::XML::Element:0x81f47cd0 name=meta attributes=[#Nokogiri::XML::Attr:0x81f47bf4 name=name value=description, #Nokogiri::XML::Attr:0x81f47be0 name=content], #Nokogiri::XML::Element:0x81f47c80 name=meta attributes=[#Nokogiri::XML::Attr:0x81f47320 name=name value=author, #Nokogiri::XML::Attr:0x81f4730c name=content]], #Nokogiri::XML::Element:0x81f4677c name=body children=[#Nokogiri::XML::Text:0x81f46470 \n \t, #Nokogiri::XML::Element:0x81f46420 name=header children=[#Nokogiri::XML::Element:0x81f46128 name=hgroup children=[#Nokogiri::XML::Element:0x81f45ea8 name=h1 children=[#Nokogiri::XML::Text:0x81f45c14 Mut8 Testing], #Nokogiri::XML::Text:0x81f45aac \n \t, #Nokogiri::XML::Element:0x81f45a5c name=h2 children=[#Nokogiri::XML::Text:0x81f45764 In Progress...], #Nokogiri::XML::Text:0x81f455fc \n \t ]], #Nokogiri::XML::Element:0x81f453cc name=div attributes=[#Nokogiri::XML::Attr:0x81f4514c name=id value=content] children=[#Nokogiri::XML::Text:0x81f4307c \n \t , #Nokogiri::XML::Element:0x81f4302c name=h3 children=[#Nokogiri::XML::Text:0x81f42d34 My Page Title Here!], #Nokogiri::XML::Text:0x81f42bcc \n \t , #Nokogiri::XML::Element:0x81f42b7c name=p attributes=[#Nokogiri::XML::Attr:0x81f42a28 name=id value=villa, #Nokogiri::XML::Attr:0x81f42a14 name=class value=bob my-class] children=[#Nokogiri::XML::Text:0x81f42410 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla eu ipsum urna, et molestie mi. \n \t \t Aliquam adipiscing, massa et fermentum ullamcorper, neque nunc consectetur enim, imperdiet \n \t \t porta lacus est non turpis. Nam id nisi vitae enim scelerisque ullamcorper vel nec magna. \n \t \t Morbi erat augue, mattis non imperdiet ac, dignissim in velit.], #Nokogiri::XML::Text:0x81f422a8 \n\n\t , #Nokogiri::XML::Element:0x81f42258 name=p attributes=[#Nokogiri::XML::Attr:0x81f42104 name=class value=my-class icon] children=[#Nokogiri::XML::Text:0x81f41cb8 Pellentesque dapibus, nisl non venenatis vehicula, quam tortor placerat lacus, hendrerit \n\t commodo nunc nisl non jusdddto. Donec erat nulla, facilisis fringilla vestibulum et, iaculis \n\t eu metus. Sed aliquet ultrices nunc quis pulvinar. Quisque facilisis dolor sed mauris
[Rails] Re: Nokogiri gem issues
I did $ yum list updates and the only one that said there was an update that was close to libxml2 was 'libxml2-python'. I updated that and it still does not work. When I checked the version, the output was this: === xmllint --version xmllint: using libxml version 20626 compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug === Is there any other dependancies that I may need to update as well? Thank you for the reply and your help -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Sproutcore and Rails3
It looks like it's looking for these stylesheet.css and javascript.js in a number of different directories inside public. Why would it be doing that? Why wouldn't the tutorial even mention that? It seems like a configuration isn't correct some how. In the actual app/sproutcore directory there's a tmp/ directory that contains a this type of file structure within it (static/sproutcore/ and so on). I feel it's not pointing to the correct place or something. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Sproutcore and Rails3
I'm attempting to create a sproutcore application with a rails 3 backend and am getting very frustrated because the only documentation I'm finding on this is from sproutcore and their tutorials leave something to be desired. I was following the Todo list app tutorial and continued to get errors until I followed the actual video tutorial, which was different with different code and was able to get that running. Now I'm following http://sproutguides-drogus.strobeapp.com/rails.html, except I'm using my own sproutcore app that I created while following this tutorial (instead of using the Todos from github). I go to load the page and I get loading in the browser and repeated RoutingError in my development.log --- Started GET /_sproutcore for 127.0.0.1 at Tue Jul 26 15:24:06 -0400 2011 Started GET /static/sproutcore/foundation/en/current/stylesheet.css?1311606026 for 127.0.0.1 at Tue Jul 26 15:24:07 -0400 2011 ActionController::RoutingError (No route matches /static/sproutcore/foundation/en/current/stylesheet.css): Rendered /Users/kraymond/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-3.0.8/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.6ms) Started GET /static/sproutcore/standard_theme/en/current/stylesheet.css?1311606027 for 127.0.0.1 at Tue Jul 26 15:24:07 -0400 2011 ActionController::RoutingError (No route matches /static/sproutcore/standard_theme/en/current/stylesheet.css): Rendered /Users/kraymond/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-3.0.8/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.6ms) --- It just goes on from there for quite some time. I'm not finding anything with this when I google it. Does anyone have any experience using sproutcore 2.0 and Rails 3.0.8 or even any rails 3.0.0? Or even if you have an idea of what's going on, I'm all ears. I'm using Rails 3.0.8 and bulk_api gem and sproutcore 2.0 Thank you -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Sproutcore and Rails3
No, I'm a newbie when it comes to sproutcore. I've been working with rails for almost a year now and feel pretty comfortable with that. Could you post a link to a tutorial doing rails and sproutcore 1.x if you know of any. Though I would like to use 2.0 if possible Thanks for you quick reply! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Regular expression not working in Rails
I can't figure out why this regexp isn't working in my rails method. I've been testing it with the the firefox regular expression tester add on and it works there but not in the rails app. My expression is: /\Q[img['\E/ I'm trying to match: [img[' I am getting an error saying Early end to regexp or something like that -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Thinking Sphinx sorting problem
Hello all, I'm trying to get some records in my application to sort based on a SQL calculated value and am getting no records returned. I have checked and double checked and the query that TS is indexing is working out, but the problem is with the controller. Here is what I'm indexing: -- indexes ((#{AppSystem::Income::BASE} - applications.monthly_income * 12)) + SUM(#{AppSystem::Income::ADDITIONAL} - (COALESCE(household_members.monthly_income, 0) * 12)), :sortable = true, :as = :applicant_need, :joins = :household_members, :type = :float -- It's a pretty complex index, but again it is working. It creates an index of a float that is a Max income to qualify (MIQ) minus Total Household Income (THI) MIQ - THI and this is what is indexed. In my controller, I have a search action: -- def search @searched = params[:search] @sort = params[:sort_by].to_i @filter = params[:filter_by].to_i application_ids = Application.search_for_ids(@searched, :select = id, applicant_id, :group_by = 'applicant_id', :group_function = :attr, :with = Application.filter_for_search(@filter, @season), :sort_mode = :extended, :order = Application::Search::SortBy::sphi...@sort], # this gives me sql string to sort by :per_page = 1000) @applicant_ids = Applicant.search_for_ids(@application_ids '#{application_ids * '|'}', :match_mode = :extended2, :page = params[:page], :per_page = 5, :sort_mode = :extended, :order = Application::Search::SortBy::sphi...@sort]) # this gives me sql string to sort by @applicants = @applicant_ids.empty? ? [] : Applicant.find(@applicant_ids, :select = applicants.*, MAX(applications.created_at) AS most_recent, :joins = [:applications], :group = applicants.id, :order = Application::Search::SortBy::valu...@sort]).to_a # this gives me sql string to sort by render :action = 'index' end -- When user sorts by last name related to application (first_name or last_name, ASC or DESC) the sorting works fine. But sorting on applicant_need (calculated float) I get no results. Doing a Rails.logger.info check below each (application_ids, @applicant_ids and @applicants) I get this: -- application_ids [4, 2, 1] @applicant_ids [] # all other sorting would have an array of ids here @applicant [] -- I would appreciate any insight you might have. Thank you -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Substruct Shopping cart for rails 3?
Hello, I'm still desperate for a solution to this. A couple of weeks ago I posted a question about a free and open-source shopping cart called Substruct. It looks like it's what I need, but I can't find anything for the Rails3 upgrade. Not true- Sorry, I did find: http://github.com/rubyjedi/substruct I started following these instructions just to see, using updated code and practices where I saw they were needed but ran into this error pretty early on. When I do the $ rake substruct:db:bootstrap I get: --- Mysql2::Error: Table 'quilting_development.content_nodes' doesn't exist: SELECT `content_nodes`.* FROM `content_nodes` --- I'm new to RoR and have been lucky in that I started to learn it just before Rails 3 was released officially. My working environment is setup for Rails 3 and Ruby 1.8.7. Unfortunately I need a free shopping cart solution and the documentation for substruct and Rails3 is non-existent. The link above has a branch for rails 3 but the documentation is the same as Rails 2 If anyone knows where I can find documentation for this or another, good free shopping cart I would greatly appreciate it. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Rails 3 substruct documentation
Hello all, Does anyone know where I can find documentation for the Rails 3 branch of Substruct (shopping cart) I found this branch but the documentation looks to be the same as the rails 2. http://github.com/rubyjedi/substruct I still tried to follow this just to see, but when I get to $ rake gems:build I get the 'Don't know how to build tasks 'gem:build' Then when I do the $ rake substruct:db:bootstrap I get: Mysql2::Error: Table 'quilting_development.content_nodes' doesn't exist: SELECT `content_nodes`.* FROM `content_nodes` Also the substruct for rails 2 was a whole application while the rails branch I downloaded only what went in the vender/plugins file and did not include the Gems. Any thoughts or help in finding the documentation would be appreciated. Thank you in advance -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] html input strings to database column integers
Hello all, I am pulling my hair out on this. It seems like it should be the easiest thing in the world to do, but it's just escaping me. I have a rails built form and but I keep getting this error when I submit it: Mysql::Error: Column 'user_id' cannot be null: INSERT INTO `games` (... I have a hidden field in my form that collects @user.id which is passed by the controller. % form_for @game, :url = user_games_path(@user), :method = :post do |f| % %= f.hidden_field :user_id, :value = @user.id % div class=formfield %= f.label :my_user_empire % %= f.select :user_empire, Game::SelectableEmpires.options_for_select % /div div class=formfield %=f.submit Begin Game % /div % end % Controller: def new @user = User.find(params[:user_id]) @game = Game.new end And I am pretty sure the problem is b/c the HTML hidden field is sending the database a string and the DB is expecting an integer. I've tried this in the model: before_validation :user_id def user_id self.user_id.to_i end but I get the error: stack level too deep I would greatly appreciate any help. Thank you. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: html input strings to database column integers
Here is my games model. I do have a belongs_to relationship with users and users has_one game. The problem isn't with this relationship though. I am able to get retrieve any information related to the @user, no problem. The problem I am having is that in my form I have html inputs that need to post to my database. But the database is looking for integers here and the form outputs strings. I need to know if there's an easy (or any) to have these values from my form be converted to integers before_save. I thought that what I have below with defining user_id as self.user_id.to_i would do it but I get that stack error. class Game ActiveRecord::Base belongs_to :user before_validation :user_id before_validation :user_empire def user_id self.user_id.to_i end def user_empire self.user_empire.to_i end end Again my form: % form_for @game, :url = user_games_path(@user), :method = :post do |f| % %= f.hidden_field :user_id, :value = @user.id % div class=formfield %= f.label :my_user_empire % %= f.select :user_empire, Game::SelectableEmpires.options_for_select % /div div class=formfield %=f.submit Begin Game % /div % end % -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: html input strings to database column integers
Thank you for your response. So I've realized that the model is just not receiving anything from these fields. I added: validates_presence_of :user_id validates_presence_of :user_empire validates_presence_of :difficulty and I get the error in the form: User can't be blank User empire can't be blank In the development log it shows these being posted with the correct names, I've double checked them in the DB and it all matches up. So why is it not submitting what's in the input to the DB? Also it says User can't be Blank when it should be user_id. I am completely confused here. I do have the belongs_to relationship with :users but am not nesting the new game form. I don't have to still do the accepts_nested_attributes, do I? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: html input strings to database column integers
Here is my games_controller: class GamesController ApplicationController def show @user = User.find(params[:user_id]) @game = Game.find(params[:id]) end def new @user = User.find(params[:user_id]) @game = Game.new end def create @user = User.find(params[:user_id]) @game = Game.new(params[:id]) if @game.save redirect_to user_game_path(@user, @game) else render :action = 'new' end end def edit end def update end def destroy end end As you can see, I haven't even begun to fight with update or edit. Updates to the games table will occur later with responses from a flash document. From my dev_log. It shows that the fields I want are getting posted. But Rails is not seeing them. Processing UsersController#1 (for 127.0.0.1 at 2010-09-12 14:23:26) [PUT] Parameters: {user={game={num_of_enemies=7, enemy_check_box=[0, 50, 0, 0, 30, 0, 0, 20, 0, 0, 0], user_id=1, user_empire=30, difficulty=10, selection_of_enemies=2}}, commit=Begin Game, action=1, _method=put, authenticity_token=SX7VfUzPm3SdzqFoKX4DQObQaHQLXSJudlNIfEGUt2Q=, id=games, controller=users} -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Authlogic user login and register new user side-by-side
Hello all, This is my first post in this forum. I'm mostly a Actionscript/Flash guy but am learning RoR for work and to actually work with a flash game I'm making. I was hoping someone could help me with Authlogic. The gem is working fine and I can login and register new users, but I was hoping to have one page the the user will land on that will allow them to login if they have an account or create an account if they don't. Seem's pretty standard, but I am having trouble wrapping my mind around how to have them both on the same page. I understand that the 'new' user_session is the actual creation of the session and that the user 'new' is creating the user that can create a 'new' session, but how will I have them both on the same page? I was think something like this: class User ActiveRecord::Base acts_as_authentic has_one :user_session validates_presence_of :login validates_presence_of :email end and then rendering a partial of the login form on the 'new' action of users. Am I in the right direction? Thank you for your help in advance. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] NilClass passed to partial view
Hi, I have a simple program that tries to do something really basic. First, I have a company Model : - class Company ActiveRecord::Base has_one :billingAddress, :foreign_key=id, :class_name=Address end Then I have the address Model : -- class Address ActiveRecord::Base belongs_to :company end I've created manually an entry in the DB for Address and Company and I've linked them (Company table has a billingAddress_id row) In my views company/_form(scaffold generated), I want to display the address form. So I added (following Rails Guides) the following line to my view : %= render :partial = addresses/edit, :locals = { :shippingAddress = @address} % It keeps saying : undefined method `model_name' for NilClass:Class tried this : %= render :partial = addresses/edit, :locals = { @company.shippingAddress = @address} % with the same result I've tried with : %= render :partial = addresses/form, :object = @billingAddress% and I got the same result (this is normal I think since I don't have a billingAddress object but a Company object. Finally, I've tried : %= :partial = addresses/form, :object = @company.shippingAddress % and the error I got was : syntax error, unexpected tASSOC, expecting ') When I load the Company with rails console, it loads perfectly. However I cannot manage to call the aggregated object view since the name of the variable is not the same name as the class name... at least, that what I think it is :-) Can someone help me to figure this out ? I thought that this will be a simple task but it figures that it is not... Thank you very much for your time ! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: NilClass passed to partial view
Colin Law wrote: On 10 May 2010 13:49, Greg Raymond li...@ruby-forum.com wrote: class Address ActiveRecord::Base %= render :partial = addresses/edit, :locals = { :shippingAddress = @address} % It keeps saying : undefined method `model_name' for NilClass:Class tried this : In the partial have you got something.model_name? If so then 'something' is nil. In the traceback when you get the error message you should be able to see the line that is failing. Colin Thanks Colin for the fast answer : In the partial I have the standard scaffolded code for my Address class So it's a form_for @address just like Rails 3 is generates so I don't understand why I can go to /addresses/1 and see the form but I cant view the same info via a partial. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Re: NilClass passed to partial view
@Bosko : I'll try your suggestion tonight and keeps you posted. @Collin : Thanks for your time... I'll check for rails 2.3.x and if I'm not able to make this work, I may roll back Thank you guys for your help ! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Nested Rails Views
Thanks for the help so far. Here's a more concrete example of what I'm talking about. I have an app used for warehousing and fulfillment. Some of the controller domains are: Receiving Locating Items Shipping Out Items Finance Related Stuff Shipment Tracking Within just the Receiving controller there are dozens of view files because it's become larger and larger over the years. You need to be able to receive a shipment, then receiving individual items in a shipment, track exception cases, edit previous check in data, etc. I'd really like a way to organize some of those files such that I have /receiving/shipment_check_in/..., /receiving/exceptions/, /receiving/item_check_in/... All my controllers are getting to this size or are already there. I was just wondering if there was an easy way to refractor and organize projects of these size. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Nested Rails Views
I'm at the point where I have a lot of view files for each controller in my app. I'd like to be able to add another level or two of directories in my view folders just for organizational purposes. What's the best way to do this? i.e. app/views/controller/sub_dir/view.html.erb -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Nested Rails Views
Marnen Laibow-Koser wrote: Raymond O'Connor wrote: I'm at the point where I have a lot of view files for each controller in my app. Why do you have so many? It's rare to have more than about 5 views per controller. I'd like to be able to add another level or two of directories in my view folders just for organizational purposes. What's the best way to do this? i.e. app/views/controller/sub_dir/view.html.erb Answer the first question, and perhaps an idea will present itself. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org I could split the actions into multiple controllers, but then I'd want some sort of organization to group controllers then... Once a project reaches a certain size, actions tend to organize hierarchically at least my project has. Just wondering if there's an easy way to organize all those files hierarchically since their logical group is hierarchical -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Check if association cached without hitting db?
Is there a way to tell if an association on an object is cached without hitting the db? For example, let's say I have order has_many line_items, is there a way for me to tell if order.line_items is already populated? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] performance testing without counting setup
I'd like to performance test the last step (step 3) of my checkout using ActionController::PerformanceTest. Since these tests are based off integration tests, my understanding is I have to run through steps 1 and 2 in the test before I can get to step 3 (unlike a functional test where I can assign things in the session to fake steps 1 and 2). My question is, is there a way to have the performance test only report metrics related to checkout step 3? I don't want the metrics to be tainted by me going through steps 1 and 2 to get to step 3. Cheers! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] WindyCityRails - Early Registration Until Aug 1, 2009
WindyCityRails is a one-day conference packed with an abundance of Rails knowledge . Sharpen your technical skills, network with other professionals, and meet some of the top minds in the Ruby on Rails community. Developers, designers, entrepreneurs, and investors all find value in WindyCityRails. The conference will be held Saturday, September 12, 2009 in Chicago. Early registration remains in place until August 1, 2009. Visit http://windycityrails.org for details. See you at the conference! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] How to aggregate tags on child nodes?
Let's say I have a Recipe model, and it is a parent of the Review model. Reviews are entered by users of the system, with one or more tags using the acts_as_taggable_on_steroids plugin (for instance). What I'm interested in is how to show *all* tags for a particular Recipe - meaning all tags applied to every child Review of that Recipe. For an example of what I'm talking about, look at this page from this fine website: http://97bottles.com/breweries/us/ca/santa-rosa/russian-river-brewing-company/blind-pig-ipa/ They are showing the most popular tags from all Reviews on a particular Beer. I'm trying to figure out how to do that. But I have no idea where to start, since the tagging is such a wily concept to me. Any suggestions? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] ActionMailer Layout on HTML version not Plain Text
I'm sending plain text and html emails by having multiple files for each email I send. For example, for my registration email I have a registration.text.plain.erb file and a registration.text.html.erb file. I want to use a layout for the html version of my emails. In my mailer I put: class AccountsMailer ActionMailer::Base layout 'email' ... end Unfortunately rails seems to look for views/layouts/email.html.erb and uses that layout for both my HTML and plain text emails. When I name the file email.text.html.erb rails complains: Missing layout layouts/email.erb ... How do I set up action mailer so that it uses a layout only for the html version of emails? Thanks -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---