ruby-on-rails

Help building a rails cms

I want to build a cms from scratch on rails.... I want it to be as similar as it can be to wordpress. What tips can you give me?.. Should the admin part and the user part be completely separated as in a totally different app?.. or should all be integrated into one app?... How would you set it up??.. please be as specific as you can be. ...

HABTM Double-Nested fields_for

Interesting segment of code that I can't get to work. I have the following models/relationships (unnecessary code excluded) class Service < ActiveRecord::Base belongs_to :service_category, :foreign_key => "cats_uid_fk" belongs_to :service_type, :foreign_key => "types_uid_fk" has_and_belongs_to_many :service_subtypes, :join_table =...

Rails development

Hi, I've basicall got a rails app that serves XML happily but I now need to add a HTML admin area. Whats the quickest way that I can do this? My database and models are all happy and all I need now is run some magic script to turn it all into a website - is there anything that will do this? If not - why not!? Thanks in advance Ch...

ActiveRecord hating a particular column? (Bizarre)

Hey guys, I've been working on a web app lately, and Activerecord has started creeping me out- for the most part it's awesome, but it has taken to treating a particular column like a leper. Initially I created a student model from a scaffold. The model holds various information like name, email, entry quarter, etc. And that all works b...

Call rails method periodically

Hi, I want a rails method to be called automatically whenever the contents of a textfield is changed, or every n seconds. How can I do this? The method is on the object's model definition. Also, how can I get the content of the textfield? Thanks. ...

Rails & MSSQL 2008 - Will We Hit Barriers?

The company I am working for is looking to switch platforms from ColdFusion 8 / Windows to Ruby on Rails / Linux. Our database solution will remain as MSSQL 2008 on Windows. I will likely follow up with a series of questions relating to this migration separately, but for now I have a MSSQL & Rails specific question. Back in 2006 when I ...

The Ruby community values simplicity...what's your argument for simplifying a db schema in a new project?

I'm working on a project with developers who have not worked with Ruby OR Rails before. They have created a schema that is too complicated, in my opinion. The schema has 117 tables, and obtaining the simplest piece of information would require traversing/joining 7 tabels...and of course, there's no "main" table that serves as a sort of...

Getting value from query

Hello, I'm having problems with getting a value from a single column call. select sum(price) as testPrice from sales where quantity > 10 but when I inspect the resultset, I get the following, [#"5"}>] Any help is appreciated, thank you. ...

Rails RESTful Routing With '/' and Slugs

I am looking to do something similar a wordpress slug where I have a URL like this while maintaining RESTful routing: http://foo.com/blog/2009/12/04/article-title The reason I am interested in keep RESTFUL routing is that I am unable to use many plugins because I am using custom routes. I have already done the RESTful appearance with:...

Using has many :through

Using has_many => through association. Here is what i have. :planning model has_many :acttypes has_many :actcategories has_many :acts, :through => :actcategories :acts model belongs_to :acttype has_many :actcategories has_many :plannings, :through => :actcategories :actcategories model named_scope :theacts, lambda { |my_id| ...

Rails Associate Invites to Events

I have a rails question that I cannot seem to wrap my head around. I have an Invite model which will represent a name, address, number of people on the invitation, plus 1 or not, etc. I also have an Event model which has name, location, and time of the event. I would like to associate Invites to Events through something like a Sche...

Question about a/bingo basics (a/b testing)

from: http://www.bingocardcreator.com/abingo/usage #A view example with a block passed to ab_test: <% ab_test("call_to_action", %w{button1.jpg button2.jpg}) do |button| > <%= image_tag(button, :alt => "Call to action!" %> <% end %> Does whatever "choice" that gets passed in the block have to be some sort of link? How does a/bingo kn...

Make Rails 2.3.5 aware of rails engine view path

According to the Ruby on Rails 2.3 Release Notes... if your plugin has an app folder, then app/[models|controllers|helpers] will automatically be added to the Rails load path. Engines also support adding view paths now, and ActionMailer as well as Action View will use views from engines and other plugins. There is supposed to be so...

ActiveRecord :select is messing with my data types

So I have this very simple snippet. Topic.all(:select => 'count(*) as cnt')[0].cnt # behaves the same on all models "500" # What, a string? It seems that for some reason ActiveRecord is coercing the count to a string. In fact, I notice it coerces everything in the select list missing from the original object to a string. Why does...

configuring Rails on IIS ?

We are planning to take a virtual dedicated server where we can host our .NET , PHP and rails application together . Since we need to host .NET webapps , linux is out of question . I have configured PHP on IIS , but was wondering if it is possible to configure rails with IIS . We want to avoid another webserver running just for rails ...

Getting Delayed-jobs working within a model

I have a model which represents a document, the title, author, etc is scraped from a web table, but the content needs to be pulled from a PDF which is time and resource intensive. This seems like a logical place to used delayed_jobs but it always fails and so I'm wondering if there is a limitation I am missing or a GCE #working code do...

How to add Google AutoComplete/AutoSuggest feature in rails using Google Ajax API ?

I have successfully integrated google ajax search with rails application . Does Google Ajax Search Api provides api for autocomplete/autosuggest feature in rails application ? . Is there a way to integrate google search autocomplete feature in Rails ? Any body worked on the same please share your experience . Thanks !! ...

Named Routes in Rails: how to capture a custom url and then send params to update

I want to have this exact named route that I can put in views: <%= link_to publish_review_path(@review) %> ... I would like it to map to a path like this: "/reviews/3456/publish" ... and then when that pattern is matched, have the following sent to the controller: { :controller => "reviews", :action => "update", :id => "3...

Why isn't link_to filling the params correctly?

I'm generating links from the home page (controller = 'landings') via a partial containing: <%= link_to t.to_s, assets_path, :name => t.to_s %> where assets/index is the controller/method that I'd like to pass the :name to. However, after I've clicked the link, and control is thrown to the assets/index controller, params.to_s = "actio...

Is Ruby pass by reference or by value?

I am having this problem which I can't seem to get my head around. I would like some help on this. @user.update_languages(params[:language][:language1], params[:language][:language2], params[:language][:language3]) lang_errors = @user.errors logger.debug "--------------------LANG_ERRORS----------101-------------" + lang_erro...