Search Results

Search found 7350 results on 294 pages for 'rspec rails'.

Page 23/294 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • How to add a checkbox for each row in Rails 3.2 index page?

    - by user938363
    We would like to add a checkbox to each row on Rails index page to flag for the row. This checkbox is not part of the object (no checkbox boolean in database). When the index page shows, a user can check the box to trigger an event for the row in following process: #objects/checkbox_index.html.erb <table> <tr> <th>CheckBox</th> <th>Object Name</th> <th>Object ID</th> </tr> <%= @objects.each do |obj| %> <tr> <td><%= checkbox %></td> <td><%= obj.name %></td> <td><%= obj.id %></td> </tr> <% end %> </table> In controller, the process will be like this: @objects.each do |obj| some_event if obj.checked end There are a couple of questions we don't quite understand: 1. How to declare an array checkbox variable on the form and link it to each row of obj? We have been using `attr_accessor` to declare var for a form. 2. How to retrieve each row on checkbox_index form and pass them back to controller? We are using simple_form for new/edit. Can anyone point me towards any good examples of this sort of behavior, or suggest what we should be thinking about? Many Thanks.

    Read the article

  • what is the wrong with this spec and controller code?

    - by user1609468
    I'm trying to test an existing rails project with rspec. And I want to test a controller but getting an error which I can't solve :S Here is the my spec code ; require 'spec_helper' describe BriefNotesController do before(:all) do @customer=Factory(:customer) @project=Factory(:project_started, :owner => @customer) end context 'get :new' do it 'should redirect to login page for not signed in users' do get :new, :project_id => @project.id response.should redirect_to("/kullanici-girisi") end it 'should be success and render new brief note page for project owner' do sign_in @customer get :new, :project_id => @project.id response.should be_success end end end Here is the my controller code ; class BriefNotesController < ApplicationController before_filter :authenticate_user! before_filter :find_project def new @brief_note = @project.brief_notes.new end def create @brief_note = @project.brief_notes.build(params[:brief_note]) if @brief_note.save redirect_to brief_project_path(@project) else render :action => :new end end private def find_project @project = current_user.projects.find_by_cached_slug([params[:project_id]]) end end I think current_user.projects.find_by_cached_slug method don't work. So this is the error; Failures: 1) BriefNotesController get :new should be success and render new brief note page for project owner Failure/Error: get :new, :project_id => @project.id NoMethodError: undefined method `brief_notes' for nil:NilClass # ./app/controllers/brief_notes_controller.rb:6:in `new' # ./spec/controllers/brief_notes_controller_spec.rb:19:in `block (3 levels) in <top (required)>'

    Read the article

  • Passenger not booting Rails App

    - by firecall
    I'm at the end of ability, so time to ask for help. My hosting company are moving me to a new server. I've got my own VPS. It's a fresh CentOS 5 install with Plesk 9.5.2 Essentially Passenger just doesnt seem to be booting the Rails app. It's like it doesnt see it's a Rails app to be booted. I've got Rails 3.0 install with Ruby 1.9.2 built from source. I can run Bundle Install and that works. I've currently got Passenger 3 RC1 installed as per here, but have tried v2 as well. My conf/vhost.conf file looks like this: DocumentRoot /var/www/vhosts/foosite.com.au/httpdocs/public/ RackEnv development #Options Indexes I've got a /etc/httpd/conf.d/passenger.conf file which looks like this: LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.0.pre4/ext/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.0.pre4 PassengerRuby /usr/local/bin/ruby PassengerLogLevel 2 and all I get is a 403 forbidden or the directory listing if I enable Indexes. I dont know what else to do! Yikes. There's nothing in the Apache error log that I can see. The new server admin isnt much help as I think he's a bit junior and says he doesnt know about Rails... sigh :/ I'm a programmer and server admin isnt my bag :(

    Read the article

  • Passenger not booting Rails App

    - by firecall
    I'm at the end of ability, so time to ask for help. My hosting company are moving me to a new server. I've got my own VPS. It's a fresh CentOS 5 install with Plesk 9.5.2 Essentially Passenger just doesnt seem to be booting the Rails app. It's like it doesnt see it's a Rails app to be booted. I've got Rails 3.0 install with Ruby 1.9.2 built from source. I can run Bundle Install and that works. I've currently got Passenger 3 RC1 installed as per here, but have tried v2 as well. My conf/vhost.conf file looks like this: DocumentRoot /var/www/vhosts/foosite.com.au/httpdocs/public/ RackEnv development #Options Indexes I've got a /etc/httpd/conf.d/passenger.conf file which looks like this: LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.0.pre4/ext/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.0.pre4 PassengerRuby /usr/local/bin/ruby PassengerLogLevel 2 and all I get is a 403 forbidden or the directory listing if I enable Indexes. I dont know what else to do! Yikes. There's nothing in the Apache error log that I can see. The new server admin isnt much help as I think he's a bit junior and says he doesnt know about Rails... sigh :/ I'm a programmer and server admin isnt my bag :(

    Read the article

  • Run a rails server on Amazon EC2 [on hold]

    - by Jashwant
    Context: I've tried rubber gem, but that does not fulfill my requirements ( I needed to deploy on existing instance, so don't recommend me rubber) So, I followed this excellent tutorial http://stackoverflow.com/questions/15535140/installing-ruby-2-0-and-rails-4-0-0beta-on-aws-ec2 Now, I have ruby 2.0 and rails 4.0.0 running on AWS EC2. I successfully ran the server with RDS (mysql) as db and default webrick as server ( Using command rails server ) But, I've read that webrick is a development server and shouldn't be used at production. What I tried: I googled and came up with some alternatives. Capistrano Nginx / apache with passenger Passenger with Capistrano Unicorn Puma My Question: What exactly is capistrano / passenger ? Are they middleware to ease my deployment process ? I don't see any difficulty in doing rails server command. If they are just middleware, nginx with passenger and capistrano does not make any sense ? Why would I add a learning curve ( to learn nginx, passenger and capistrano configs) just to run my server ? I can just use nginx to deploy my app. Can't I ? What combination should I use on Amazon EC2 (or may be at any some other production server).

    Read the article

  • Problem in starting Rails server [on hold]

    - by Ahsan Rony
    when I start rails s I get the following error: C:\Sites\ticketee>rails s => Booting WEBrick => Rails 4.1.4 application starting in development on http:/0.0.0.0:3000 => Run `rails server -h` for more startup options => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0 .0.1 (--binding option) => Ctrl-C to shutdown server Exiting C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.1.4/lib/act ive_support/dependencies.rb:247:in `require': cannot load such file -- treetop/r untime (LoadError) from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/dependencies.rb:247:in `block in require' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/dependencies.rb:247:in `require' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/mail-2.5.4/lib /load_parsers.rb:7:in `<module:Mail>' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/mail-2.5.4/lib /load_parsers.rb:6:in `<top (required)>' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/dependencies.rb:247:in `require' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/dependencies.rb:247:in `block in require' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/dependencies.rb:247:in `require' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/mail-2.5.4/lib /mail.rb:79:in `<module:Mail>' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/mail-2.5.4/lib /mail.rb:2:in `<top (required)>' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/dependencies.rb:247:in `require' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/dependencies.rb:247:in `block in require' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/dependencies.rb:247:in `require' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/actionmailer-4 .1.4/lib/action_mailer/base.rb:1:in `<top (required)>' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/actionmailer-4 .1.4/lib/action_mailer/railtie.rb:49:in `block in <class:Railtie>' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/lazy_load_hooks.rb:36:in `call' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/lazy_load_hooks.rb:44:in `each' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport- 4.1.4/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/application/finisher.rb:64:in `block in <module:Finisher>' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/initializable.rb:30:in `instance_exec' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/initializable.rb:30:in `run' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/initializable.rb:55:in `block in run_initializers' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block i n tsort_each' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block ( 2 levels) in each_strongly_connected_component' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_st rongly_connected_component_from' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block i n each_strongly_connected_component' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_st rongly_connected_component' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_e ach' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/initializable.rb:54:in `run_initializers' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/application.rb:300:in `initialize!' from C:/Sites/ticketee/config/environment.rb:5:in `<top (required)>' from C:/Sites/ticketee/config.ru:3:in `require' from C:/Sites/ticketee/config.ru:3:in `block in <main>' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib /rack/builder.rb:55:in `instance_eval' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib /rack/builder.rb:55:in `initialize' from C:/Sites/ticketee/config.ru:in `new' from C:/Sites/ticketee/config.ru:in `<main>' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib /rack/builder.rb:49:in `eval' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib /rack/builder.rb:49:in `new_from_string' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib /rack/builder.rb:40:in `parse_file' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib /rack/server.rb:277:in `build_app_and_options_from_config' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib /rack/server.rb:199:in `app' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/commands/server.rb:50:in `app' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib /rack/server.rb:314:in `wrapped_app' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/commands/server.rb:130:in `log_to_stdout' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/commands/server.rb:67:in `start' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/commands/commands_tasks.rb:81:in `block in server' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/commands/commands_tasks.rb:76:in `tap' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/commands/commands_tasks.rb:76:in `server' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/commands/commands_tasks.rb:40:in `run_command!' from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.4 /lib/rails/commands.rb:17:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>' C:\Sites\ticketee> it exit automatically exits though I don't press Cntr+C Can anyone help me to fix this problem

    Read the article

  • Eclipse juno - ubuntu 12 > can't install RadRails throws error for a gem i have installed allready

    - by Bogdan M
    The thing is I installed ubbuntu 12, java(for eclipse), eclipse, ruby, ruby gems, rails. Everything went smooth. When i tried to prepare eclipse for ruby on rails i isntaled ruby dev kit plugin. This workd, but RadRails failed with this error: Cannot complete the install because one or more required items could not be found. Software currently installed: org.radrails.rails-feature 0.7.2 (org.radrails.rails_feature.feature.group 0.7.2) Missing requirement: Rails Core Plug-in 0.7.2 (org.radrails.rails.core 0.7.2) requires 'bundle org.eclipse.update.core 0.0.0' but it could not be found Cannot satisfy dependency: From: org.radrails.rails-feature 0.7.2 (org.radrails.rails_feature.feature.group 0.7.2) To: org.radrails.rails.core [0.7.2]

    Read the article

  • Eclipse juno: Can't install RadRails throws error for a gem I have installed already

    - by Bogdan M
    The thing is I installed Ubuntu 12.04, Java (for Eclipse), Eclipse, ruby, ruby gems, rails. Everything went smooth. When I tried to prepare Eclipse for ruby on rails, I installed ruby dev kit plugin. This worked, but RadRails failed with this error: Cannot complete the install because one or more required items could not be found. Software currently installed: org.radrails.rails-feature 0.7.2 (org.radrails.rails_feature.feature.group 0.7.2) Missing requirement: Rails Core Plug-in 0.7.2 (org.radrails.rails.core 0.7.2) requires 'bundle org.eclipse.update.core 0.0.0' but it could not be found Cannot satisfy dependency: From: org.radrails.rails-feature 0.7.2 (org.radrails.rails_feature.feature.group 0.7.2) To: org.radrails.rails.core [0.7.2]

    Read the article

  • What a c++ dev can expect on an interview to Rails company?

    - by Nazgob
    Hello, little background first. I have been working on C++ backend large scale apps for over 5y. I'm doing TDD, using STL and Boost etc. I decided I need a change and about year ago started learning Ruby, few months ago I started playing with Rails, html5 and css. I don't know JavaScript(yet... I focus on Rails now) What can I expect on an interview for a Ruby on Rails backend developer job? How can I present myself to take advantage of my c++ experience? I'm on a senior level now and I can't start from intern position.

    Read the article

  • No rails commands will run

    - by Jeremy
    I am trying to learn rails and haven't used it in the last few weeks but today when I try to run any rails commands such as - 'rails -v' - 'script/server' I get not have reinstalled ruby but the didn't don't have a clue what could be wrong Am on a brand new Macbook Pro Jeremy-Geross-MacBook-Pro:~ Jeremy$ rails -v /Library/Ruby/Site/1.8/rubygems/config_file.rb:172:in merge': can't convert String into Hash (TypeError) from /Library/Ruby/Site/1.8/rubygems/config_file.rb:172:ininitialize' from /Library/Ruby/Site/1.8/rubygems.rb:384:in new' from /Library/Ruby/Site/1.8/rubygems.rb:384:inconfiguration' from /Library/Ruby/Site/1.8/rubygems.rb:634:in path' from /Library/Ruby/Site/1.8/rubygems/source_index.rb:68:ininstalled_spec_directories' from /Library/Ruby/Site/1.8/rubygems/source_index.rb:58:in from_installed_gems' from /Library/Ruby/Site/1.8/rubygems.rb:881:insource_index' from /Library/Ruby/Site/1.8/rubygems/gem_path_searcher.rb:81:in init_gemspecs' from /Library/Ruby/Site/1.8/rubygems/gem_path_searcher.rb:13:ininitialize' from /Library/Ruby/Site/1.8/rubygems.rb:839:in new' from /Library/Ruby/Site/1.8/rubygems.rb:839:insearcher' from /Library/Ruby/Site/1.8/rubygems.rb:838:in synchronize' from /Library/Ruby/Site/1.8/rubygems.rb:838:insearcher' from /Library/Ruby/Site/1.8/rubygems.rb:478:in find_files' from /Library/Ruby/Site/1.8/rubygems.rb:1103 from /usr/bin/rails:9:inrequire' from /usr/bin/rails:9

    Read the article

  • Ruby on Rails equivalent for Maven Archetypes

    - by Drew
    Maven Archetypes are handy ways to get a project up and going in no time flat. Rails is kinda like an archetype in and of itself. However, I'm curious to know if there are any Rails equivalents for Maven Archetypes. For example, I want to create an Archetype with full authentication already built in via Authlogic. With Maven Archetypes I would need to build a project with it already ready to go, create my archetype and start working back parameterizing things that should be parameterized. Then anyone can make a Rails project with Authlogic set up by filling out a few questions during the archetype generate command and boom! Fully functional Rails app with Authlogic built in. Is there a Rails Equivalent? Are Generators expected to do this? Is this just not Rails-y?

    Read the article

  • ruby rails loop causes server freeze

    - by Darkerstar
    Hi all: I am working on a Ruby on Rails project on Windows. I have Ruby 1.86 and Rails 2.35 installed. Everything is fine until I tried to implement a comet process. I have the following code written to respond to a long poll javascript request. But everytime this function is called, it will hang the whole rails server, no second request can get in, until the timeout. (I know there is juggernaut, but I like to implement one myself first :) Is this due to my server setup? The project will be deployed on a linux server with Ngix and Passenger setup, will it suffer the same problem? def comet_hook timeout(5) do while true do key = 'station_' + station_id.to_s + '_message_lastwrite' if Rails.cache.exist?(key) @cache_time = DateTime.parse(Rails.cache.read(key)) if @cache_time > hook_start @messages = @station.messages_posted_after(hook_start) hook_start = @cache_time break end end end ... end Also with Rails memory store cache, I keep getting "cannot modify frozen object" error, so the above script only worked for me when I switched to File cache. :(

    Read the article

  • Have Rails 2.3.x ignore the i18n gem

    - by Jared
    I have a Rails 2.3.5 project that uses the localization features of Rails. I also happen to have Rails 3 beta installed (which depends on the i18n gem). Rails 2.3.5 will happily handle localization on it's own (without i18n installed), however if the i18n gem is available, it makes use of it. Recently I upgraded my gems and now have version 0.3.7 and 0.4.0 of i18n installed. Rails, of course, wants to load and use the latest version which is causing errors in my project. I tried setting the gem version to 0.3.7 which gets around the errors in the web app. However, we're using resque and resque_mailer to delay the sending of messages. When the worker picks up the mailer job from the queue, it ignores my config.gem requirement in environment.rb and uses version 0.4.0 anyway. Ideally, I'd like to tell Rails to just not use the i18n gem at all. How do I do that?

    Read the article

  • Why I am not able to run rails tests

    - by dorelal
    This is what I did. > git clone git://github.com/rails/rails.git > cd rails > cd railties > rake And I got following error. (in /Users/dorelal/dev/scratch/rails/railties) ./test/isolation/abstract_unit.rb:236:in `initialize': No such file or directory - /Users/dorelal/dev/scratch/rails/railties/tmp/app_template/config/boot.rb (Errno::ENOENT) from ./test/isolation/abstract_unit.rb:236:in `open' from ./test/isolation/abstract_unit.rb:236 from ./test/isolation/abstract_unit.rb:222:in `initialize' from ./test/isolation/abstract_unit.rb:222:in `new' from ./test/isolation/abstract_unit.rb:222 from test/application/configuration_test.rb:1:in `require' from test/application/configuration_test.rb:1 rake aborted! I checked ~/railties/tmp and this directory is empty. I know rails is not broken. So what am I missing?

    Read the article

  • ruby rails installation problem

    - by CHID
    Hi i am installing ruby on rails. I installed version 3.0.0 and then wanted to update it to version 3.0.1 So i removed the executable files by giving gem uninstall rails Then i again tried installing by giving gem install rails -v 3.0.1 It says Succesfully installed rails-3.0.1 1 gem installed Installing ri documentaion details for rails -3.0.1 File not found: lib I tested by giving rails -v Now it is saying an error called Could not find gem 'sqlite3-ruby (= 0, runtime)' in any of the gem sources list ed in your Gemfile. Try running `bundle install`. Can anyone tell me what i am missing. I am using WINDOWS 7

    Read the article

  • Rails 3 render :partials

    - by user297221
    Hi guys. I am migrating my 1.8.7 rails app to rails 3. But I have a problem with a partial: I have the following partial: in my cms controller : @clients = Client.all group = render_to_string :layout = 'layouts/window', :partial = 'clients/index' in my "clients/index" partial: <%= render :partial = 'clients/item', :collection = @clients % This worked great with rails 1.7.8 but with rails 3 only the partial in the index get's rendered!. So, to clarify this, the group variable in the controller doesn't get the html from the layout. Also the weird thing is that the window layout is _window.erb (if I do window.html.erb or just window.erb rails can't find it which is strange). Does anybody know if this behavior is normal for rails 3? thanxs!

    Read the article

  • Rails test across multiple environments

    - by DSimon
    Is there some way to change Rails environments mid-way through a test? Or, alternately, what would be the right way to set up a test suite that can start up Rails in one environment, run the first half of my test in it, then restart Rails in another environment to finish the test? The two environments have separate databases. Some necessary context: I'm writing a Rails plugin that allows multiple installations of a Rails app to communicate with each other with user assistance, so that a user without Internet access can still use the app. They'll run a local version of an app, and upload their work to the online app by saving a file to a thumbdrive and taking it to an Internet cafe. The plugin adds two special environments to Rails: "offline-production" and "offline-test". I want to write functional tests that involve both the "test" and "offline-test" environments, to represent the main online version of the app and the local offline version of the app respectively.

    Read the article

  • Rails: authentication system based on external API

    - by Slevin
    i'm building a Rails application to extend features of an existing online Rails app. The existing Rails app provides an API for authentication. My approach: user X have an account at the existing Rails app. With these login data the user X should authenticate on my Rails app. The existing app offers a gem to connect to the API after login. Whats the best method to store the information about a successful login? Should i use sessions? Or does Rails offer better methods for this?

    Read the article

  • using helper methods in a view in rails 3

    - by Frida777
    Hello everyone, there is something that is disturbing me a bit about rails 3. i am trying to upgrade my application from rails 2 to rails 3. i followed all the steps necessary to do and things were working well for me till now except one thing: i have a helper method that is defined differently in different helpers, for example it is defined in the application_helper in one way and the same method defined in a different way in the homepage_helper, and defined differently in another helper, let's say video_helper, in addition to that, it is used in a shared view that is used throughout the application, now if i am in the homepage, i want this function to get called from the homepage_helper and if i am in the video page, the function must be called from the video_helper, based on the concept of convention in rails, this worked perfectly in rails 2 but in rails 3, the function is always called from the last helper, alphabetically ordered, that is in the example, video_helper. How can i fix this? Kindly advice. Appreciate all the help.

    Read the article

  • Why rails platform developers are changing the syntax?

    - by piemesons
    Hello i am new to rails. I am learning rails 2.3.5 and checked rails 3. I found some features added in rails 3. thats perfectly fine. But i found something different. in 2.3.5 we use ruby script/server to start the server and in rails 3 we use rails server and there are some other changes like this. Whats the improvement by doing this? whats the basic difference between this. Can anybody gimme a list of these changes and explanations for doing this?

    Read the article

  • What do I need to change to get this 'acts_as_rateable' Rails plugin working with this code from the

    - by tepidsam
    Hello! I'm working my way through the 'Foundation Rails 2' book. In Chapter 9, we are building a little "plugins" app. In the book, he installs the acts_as_rateable plugin found at http://juixe.com/svn/acts_as_rateable. This plugin doesn't appear to exist in 2010 (the page for this "old" plugin seems to be working again...it was down when I tried it earlier), so I found another acts_as_rateable plugin at http://github.com/azabaj/acts_as_rateable. These plugins are different and I'm trying to get the "new" plugin working with the code/project/app from the Foudations 2 book. I was able to use the migration generator included with the "new" plugin and it worked. Now,though, I'm a bit confused. In the book, he has us create a new controller to work with the plugin (the old plugin). Here's the code for that: class RatingsController < ApplicationController def create @plugin = Plugin.find(params[:plugin_id]) rating = Rating.new(:rating => params[:rating]) @plugin.ratings << average_rating redirect_to @plugin end end Then he had us change the routing: map.resources :plugins, :has_many => :ratings map.resources :categories map.root :controller => 'plugins' Next, we modified the following to the 'show' template so that it looks like this: <div id="rate_plugin"> <h2>Rate this plugin</h2> <ul class="star-rating"> <li> <%= link_to "1", @plugin.rate_it(1), :method => :post, :title => "1 star out of 5", :class => "one-star" %> </li> <li> <%= link_to "2", plugin_ratings_path(@plugin, :rating => 2), :method => :post, :title => "2 stars out of 5", :class => "two-stars" %> </li> <li> <%= link_to "3", plugin_ratings_path(@plugin, :rating => 3), :method => :post, :title => "3 stars out of 5", :class => "three-stars" %> </li> <li> <%= link_to "4", plugin_ratings_path(@plugin, :rating => 4), :method => :post, :title => "4 stars out of 5", :class => "four-stars" %> </li> <li> <%= link_to "5", plugin_ratings_path(@plugin, :rating => 5), :method => :post, :title => "5 stars out of 5", :class => "five-stars" %> </li> </ul> </div> The problem is that we're using code for a different plugin. When I try to actually "rate" one of the plugins, I get an "unknown attribute" error. That makes sense. I'm using attribute names for the "old" plugin, but I should be using attributes names for the "new" plugin. The problem is...I've tried using a variety of different attribute names and I keep getting the same error. From the README for the "new" plugin, I think I should be using some of these but I haven't been able to get them working: Install the plugin into your vendor/plugins directory, insert 'acts_as_rateable' into your model, then restart your application. class Post < ActiveRecord::Base acts_as_rateable end Now your model is extended by the plugin, you can rate it ( 1-# )or calculate the average rating. @plugin.rate_it( 4, current_user.id ) @plugin.average_rating #=> 4.0 @plugin.average_rating_round #=> 4 @plugin.average_rating_percent #=> 80 @plugin.rated_by?( current_user ) #=> rating || false Plugin.find_average_of( 4 ) #=> array of posts See acts_as_rateable.rb for further details! I'm guessing that I might have to make some "bigger" changes to get this plugin working. I'm asking this question to learn and only learn. The book gives code to get things working with the old plugin, but if one were actually building this app today it would be necessary to use this "new" plugin, so I would like to see how it could be used. Cheers! Any ideas on what I could change to get the "new" plugin working?

    Read the article

  • rails didnt install correclty, specificly the uninstaller

    - by sam
    ive just installed rails using railsinstaller.org for osx, rails and ruby seem to be working ok (checked by running rails -v and ruby --version). But when it installed i got an error saying that not there were errors and the uninstaller didnt install correctly. Somthing odd i saw was that when i load terminal i get this showing up Last login: Fri Nov 30 13:12:09 on ttys000 unknown5c969d7cc475:~ Sam$ specificly the "unknon5c96..." part im not sure if its related ? I think i might have got the install error as xcode wasnt installed first, for peice of mind id like to unistall it and load it back on, but when i try and run the installer from the application folder it just asks for my password and then dose nothing.. any ideas how i can fix this ?

    Read the article

  • Reverse Proxy (mod_rewrite) and Rails (absolute paths)

    - by SooDesuNe
    I have front end rails app, that reverse proxies to any of a number of backend rails apps depending on URL, for example http://www.my_host.com/app_one reverse proxies to http://www.remote_host_running_app_one.com such that a URL like http://www.my_host.com/app_one/users will display the contents of http://www.remote_host_running_app_one.com/users I have a large, and ever expanding number of backends, so they can not be explicitly listed anywhere other than a database. This is no problem for mod_rewrite using a prg:/ rewrite map reverse proxy. The question is, the urls returned by rails helpers have the form /controller/action making them absolute to the root. This is a problem for the page served by mod_rewrite because links on the proxied page appear as absolute to the domain. i.e.: http://www.my_host.com/app_one/controller/action has links that end up looking like /controller/action/ when they need to look like /app_one/controller/action mod_proxy_html seems like the right idea, but it doesn't seem to be as dynamic as I would need, since the rules need to be hard coded into the config files. Is there a way to fix this server-side, so that the links will be routed correctly?

    Read the article

  • reverse_proxy (mod_rewrite) and rails

    - by SooDesuNe
    I have front end rails app, that reverse proxies to any of a number of backend rails apps depending on URL, for example http://www.my_host.com/app_one reverse proxies to http://www.remote_host_running_app_one.com such that a URL like http://www.my_host.com/app_one/users will display the contents of http://www.remote_host_running_app_one.com/users I have a large, and ever expanding number of backends, so they can not be explicitly listed anywhere other than a database. This is no problem for mod_rewrite using a prg:/ rewrite map reverse proxy. The question is, the urls returned by rails helpers have the form /controller/action making them absolute to the root. This is a problem for the page served by mod_rewrite because links on the proxied page appear as absolute to the domain. i.e.: http://www.my_host.com/app_one/controller/action has links that end up looking like /controller/action/ when they need to look like /app_one/controller/action Is there a way to fix this server-side, so that the links will be routed correctly?

    Read the article

  • Reverse Proxy (mod_rewrite) and Rails (absolute paths)

    - by SooDesuNe
    I have front end rails app, that reverse proxies to any of a number of backend rails apps depending on URL, for example http://www.my_host.com/app_one reverse proxies to http://www.remote_host_running_app_one.com such that a URL like http://www.my_host.com/app_one/users will display the contents of http://www.remote_host_running_app_one.com/users I have a large, and ever expanding number of backends, so they can not be explicitly listed anywhere other than a database. This is no problem for mod_rewrite using a prg:/ rewrite map reverse proxy. The question is, the urls returned by rails helpers have the form /controller/action making them absolute to the root. This is a problem for the page served by mod_rewrite because links on the proxied page appear as absolute to the domain. i.e.: http://www.my_host.com/app_one/controller/action has links that end up looking like /controller/action/ when they need to look like /app_one/controller/action mod_proxy_html seems like the right idea, but it doesn't seem to be as dynamic as I would need, since the rules need to be hard coded into the config files. Is there a way to fix this server-side, so that the links will be routed correctly?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >