Search Results

Search found 11503 results on 461 pages for 'twitter bootstrap rails'.

Page 9/461 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Connect Rails model to non-rails database

    - by the_snitch
    I'm creating a new web application (Rails 3 beta), of which pieces of it will access data from a legacy mysql database that a current php application is using. I do not wish to modify the legacy db schema, I just want to be able to read/write to it, as well as the rails application having it's own database using activerecord for the newer stuff. I'm using mysql for the rails app, so I have the adapter installed. How is the best way to do this? For example, I want contacts to come from the old database. Should I create a contacts controller, and manually call sql to get the variables for the views? Or should I create a Contact model, and define attributes that match the fields in the database, and am I able to use it like Contact.mail_address to have it call "SELECT mailaddr FROM contacts WHERE id=Contact.id". Sorry, I've never done much in Rails outside of the standard stuff that is documented well. I'm not sure of what the best approach would be. Ideally, I want the contacts to be presented to my rails application as native as possible, so that I can expose them RESTfully for API access. Any suggestions and code examples would be much appreciated

    Read the article

  • Too Few Arguments

    - by NoahClark
    I am trying to get some Javascript working in my Rails app. I want to have my index page allow me to edit individual items on the index page, and then reload the index page upon edit. My index.html.erb page looks like: <div id="index"> <%= render 'index' %> </div> In my index.js.erb I have: $('#index').html("<%=j render 'index' %>"); and in my holders_controller: def edit holder = Holder.find(params[:id]) end def update @holder = Holder.find(params[:id]) if @holder.update_attributes(params[:holder]) format.html { redirect_to holders_path } #, flash[:success] = "holder updated") ## ^---Line 28 in error format.js else render 'edit' end end When I load the index page it is fine. As soon as click the edit button and it submits the form, I get the following: But if I go back and refresh the index page, the edits are saved. What am I doing wrong?

    Read the article

  • Rails 3 memory issue

    - by Erik
    Hello! I'm developing a new site based on Ruby on Rails 3 beta. I knew this might be a bad idea considering it's just beta, but I still thought it might work. Now though I'm having HUGE problems with Rails consuming huge ammounts of memory. For my application today it consumes about 10 mb per request and it doesn't seem to release it either. So I thought this might be because of bloat in my application and thus I created a test app just to compare. For my test app I just generated a model with a scaffold and then created about 20 records on this model. I then went to the index page and hit refresh and I could immediately see memory taking off! Less than my app but still about 1-3 mb per request. I'm working in OSX Leopard, with Ruby 1.8.7, Rails 3.0.0.beta and a SQLLite db for development. Does anyone recognize my problem? I would really appreciate some help here. :/ Thanks!

    Read the article

  • Ruby on Rails controller and architecture with cells

    - by dt
    I decided to try to use the cells plugin from rails: http://cells.rubyforge.org/community.html given that I'm new to Ruby and very used to thinking in terms of components. Since I'm developing the app piecemeal and then putting it together piece by piece, it makes sense to think in terms of components. So, I've been able to get cells working properly inside a single view, which calls a partial. Now, what I would like to be able to do (however, maybe my instincts need to be redirected to be more "Rails-y"), is call a single cell controller and use the parameters to render one output vs. another. Basically, if there were a controller like: def index params[:responsetype] end def processListResponse end def processSearchResponse end And I have two different controller methods that I want to respond to based on the params response type, where I have a single template on the front end and want the inner "component" to render differently depending on what type of request is made. That allows me to reuse the same front-end code. I suppose I could do this with an ajax call instead and just have it rerender the component on the front end, but it would be nice to have the option to do it either way and to understand how to architect Rails a bit better in the process. It seems like there should be a "render" option from within the cells framework to render to a certain controller or view, but it's not working like I expect and I don't know if I'm even in the ballpark. Thanks!

    Read the article

  • What is a practical way to debug Rails?

    - by Joshua Fox
    I get the impression that in practice, debuggers are rarely used for Rails applications. (Likewise for other Ruby apps, as well as Python.) We can compare this to the usual practice for Java or VisualStudio programmers--they use an interactive debugger in a graphical IDE. How do people debug Rails applications in practice? I am aware of the variety of debuggers, so no need to mention those, but do serious Rails programmers work without them? If so, why do you choose to do it this way? It seems to me that console printing has its limits when debugging complex logic.

    Read the article

  • Switching CSS to use asset pipeline in Rails?

    - by John
    I have a lot of legacy CSS files from what was a Rails 2.x app that got upgraded to Rails 3.2.8, and I want to switch over to using the Rails asset pipeline for stylesheets. The issue is, the CSS stuff is messy in terms of huge lines of code, duplicate file names, and unorganized folder structure. After looking through individual pages, and trying to add individual stylesheets and folders into the asset pipeline and spending some cycles debugging, I realized there's probably a better approach. Is there a way to test to make sure the old CSS matches up with the asset pipeline CSS? What are some good tools for testing and debugging CSS?

    Read the article

  • Modifying Service URLs with LINQ to Twitter

    - by Joe Mayo
    It’s funny that two posts so close together speak about flexibility with the LINQ to Twitter provider.  There are certain things you know from experience on when to make software more flexible and when to save time.  This is another one of those times when I got lucky and made the right choice up front. I’m talking about the ability to switch URLs. It only makes sense that Twitter should begin versioning their API as it matures.  In fact, most of the entire API has moved to the v1 URL at “https://api.twitter.com/1/”, except for search and trends.  Recently, Twitter introduced the available and local trends, but hung them off the new v1, and left the rest of the trends API on the old URL. To implement this, I muscled my way into the expression tree during CreateRequestProcessor to figure out which trend I was dealing with; perhaps not elegant, but the code is in the right place and that’s what factories are for.  Anyway, the point is that I wouldn’t have to do this kind of stuff (as much fun as it is), if Twitter would have more consistency. Having went to Chirp last week and seeing the evolution of the API, it looks like my wish is coming true.  …now if they would just get their stuff together on the mess they made with geo-location and places… but again, that’s all transparent if your using LINQ to Twitter because I pulled all of that together in a consistent way so that you don’t have to. Normally, when Twitter makes a change, code breaks and I have to scramble to get the fixes in-place.  This time, in the case of a URL change, the adjustment is easy and no-one has to wait for me.  Essentially, all you need to do is change the URL passed to the TwitterContext constructor.  Here’s an example of instantiating a TwitterContext now: using (var twitterCtx = new TwitterContext(auth, "https://api.twitter.com/1/", "https://search.twitter.com/")) The third parameter constructor is the SearchUrl, which is used for Search and Trend APIs. You probably know what’s coming next; another constructor, but with the SearchUrl parameter set to the new URL as follows: using (var twitterCtx = new TwitterContext(auth, "https://api.twitter.com/1/", "https://api.twitter.com/1/")) One consequence of setting the URL this way is that you set the URL for both Trends and Search.  Since Search is still using the old URL, this is going to break for Search queries. You could always instantiate a special TwitterContext instance for Search queries, with the old URL set. Alternatively, you can use the TwitterContext’s SearchUrl property. Here’s an example: twitterCtx.SearchUrl = "https://api.twitter.com/1/"; var trends = (from trend in twitterCtx.Trends where trend.Type == TrendType.Daily && trend.Date == DateTime.Now.AddDays(-2).Date select trend) .ToList(); Notice how I set the SearchUrl property just-in-time for the query. This allows you to target the URL for each specific query. Whichever way you prefer to configure the URL, it’s your choice. So, now you know how to set the URL to be used for Trend queries and how to prevent whacking your Search queries. I’ll be updating the Trend API to use same URL as all other APIs soon, so the only API left to use the SearchUrl will be Search, but for the short term, it’s Trends and Search. Until I make this change, you’ll have a viable work-around by setting the URL yourself, as explained above. These were the Search and Trend URLs, but you might be curious about the second parameter of the TwitterContext constructor; that’s the URL for all other APIs (the BaseUrl), except for Trend and Search. Similarly, you can use the TwitterContext’s BaseUrl property to set the BaseUrl. Setting the BaseUrl can be useful when communicating with other services. In addition to Twitter changing URLs, the Twitter API has been adopted by other companies, such as Identi.ca, Tumblr, and  WordPress.  This capability lets you use LINQ to Twitter with any of these services.  This is a testament to the success of the Twitter API and it’s popularity. No doubt we’ll have hills and valleys to traverse as the Twitter API matures, but hopefully there will be enough flexibility in LINQ to Twitter to make these changes as transparent as possible for you. @JoeMayo

    Read the article

  • Text Editor with SSH/Terminal/FTP/Putty combo for develeping in Rails on Windows

    - by Panoy
    I plan to learn Ruby on Rails and would like to code in my development box which runs on Windows XP. I have Ubuntu Server (forgot the version ;p) running as my web server with Rails installed on it. I have been considering using Vim as my text editor of choice in XP but would like to know any text editor and accompanying shell/FTP/Putty/SSH (or whatever you may call it) program that can access those files in my Ubuntu server. It is better if the shell can be called or is bundled inside the text editor. I would like to know your combinations (text editor + shell) and your experiences on it when you were able to develop your Rails projects on that combination. Cheers!

    Read the article

  • Web Host for Small Rails-based CMS site [closed]

    - by clem
    Possible Duplicate: How to find web hosting that meets my requirements? I am building a site for someone that uses a Rails-based content management system that I built myself. All of the Rails deployment experience I have so far has been over small intranets. I'm looking at web hosts like rackspace, because it seems like they're well-suited for Rails deployment. However, for a site that's not going to have more than a couple of hundred hits a month (if even that), I'm not sure it's necessary. I've also used Dreamhost's Phusion Passenger deployment for small projects before, but it seems barely functional and not well-supported, and I've also used Heroku for deployment, but I think a regular web host may do a little bit better, as they'll need things like Google Apps for Gmail set up. If anyone could provide some guidance on this, I'd greatly appreciate it. I get confused when I see things on rackspace like "1.5c/hour", because I'm not sure how that gets computed.

    Read the article

  • What is Rails way to save images?

    - by user
    I develop on iOS, and I'm switching from a PHP backend to Ruby on Rails. The interchange format is JSON. A quick Google search for 'save images in Rails' has nearly every result talking about saving image data as blobs to the database. I might be mistaken, but I'm under the impression that saving image data in a database is a huge waste of time and space (as opposed to saving a link to the file location ('/img/subcat/4656.png'). In PHP, it's pretty standard to receive the data, generate a filename, then save that file to disk, and then update the database with the image's location on disk. Is this the same for Rails, or is there some built-in ActiveRecord image functionality I'm not aware of?

    Read the article

  • WiX - create a bootstrap that passes arguments to the msi

    - by Dror Helper
    I need to create a bootstrap for my WiX project I've tried using setupbld.exe but it will only allow me to create an executable that will show my UI or one that will behave as a silent installer but not both. I need to be able to run the resulting executable with argument that will tell it wether or not to show the UI during installation. I've found this post by John Robbins that explains how to re-build the setup.exe stub used in the creation of the bootstrap but I was hoping there is a simpler way to do what I need. Does anyone know of a way to create a bootstrap that I use to run either as a simple (with UI) install or as a silent install.

    Read the article

  • How to tell rails to use non-default ruby?

    - by Hamish Downer
    I need two different versions of ruby on a server. The packaged ruby for the packaged puppet to work, and a compiled ruby for a rails web app to work. So basically I want the default ruby to be the ruby from the package, and for rails to use the compiled ruby (in /usr/local/bin/ and /usr/local/lib/ ) I've found references to setting the RUBYPATH and RUBYLIB environment variables, but I'm confused as to where to set them. In .bashrc, .profile, in the apache config somewhere?

    Read the article

  • WiX - create a bootstrap that passes arguments to the msiexec

    - by Dror Helper
    I need to create a bootstrap for my WiX project I've tried using setupbld.exe but it will only allow me to create an executable that will show my UI or one that will behave as a silent installer but not both. I need to be able to run the resulting executable with argument that will tell it wether or not to show the UI during installation. I've found this post by John Robbins that explains how to re-build the setup.exe stub used in the creation of the bootstrap but I was hoping there is a simpler way to do what I need. Does anyone know of a way to create a bootstrap that I use to run either as a simple (with UI) install or as a silent install.

    Read the article

  • environment change in rake task

    - by Mellon
    I am developing Rails v2.3 app with MySQL database and mysql2 gem. I faced a weird situation which is about changing the environment in rake task. (all my setting and configurations for environment and database are correct, no problem for that.) Here is my simple story : I have a rake task like following: namespace :db do task :do_something => :environment do #1. run under 'development' environment my_helper.run_under_development_env #2. change to 'custom' environment RAILS_ENV='custom' Rake::Task['db:create'] Rake::Task['db:migrate'] #3. change back to 'development' environment RAILS_ENV='development' #4. But it still run in 'customer' environment, why? my_helper.run_under_development_env end end The rake task is quite simple, what it does is: 1. Firstly, run a method from my_helper under "development" environment 2. Then, change to "custom" environment and run db:create and db:migrate until now, everything is fine, the environment did change to "custom" 3. Then, change it back again to "development" environment 4. run helper method again under "development" environment But, though I have changed the environment back to "development" in step 3, the last method still run in "custom" environment, why? and how to get rid of it? --- P.S. --- I have also checked a post with the similar situation here, and tried to use the solution there like (in step 2): ActiveRecord::Base.establish_connection('custom') Rake::Task['db:create'] Rake::Task['db:migrate'] to change the database connection instead of changing environment but, the db:create and db:migrate will still run under "development" database, though the linked post said it should run for "custom" database... weird

    Read the article

  • Problems installing rails on Ubuntu 12.04. Rails gems library is empty

    - by Woho87
    I got some problem installing rails on Ubuntu 12.04. I have rails working on my Ubuntu for a little time. But for some reason I uninstall rails. When I decided to install it again with sudo gem install rails . The command rails -v doesn't work. When I run the command sudo gem install rails there is no error occurring just a message that saying: Successfully installed rails-3.2.6 I look at the folder /usr/lib/ruby/gems/1.8/gems/rails-3.2.6 and it is completely empty? I wonder how I can fix this problem?

    Read the article

  • Is Cassandra production ready for Ruby on Rails?

    - by funkymunky
    I'm working on a project that is considering using Cassandra as a database. We would like to eventually migrate to Cassandra even if we use MySQL to start with, given its scalability. I know that big companies like Facebook, Digg, and recently Twitter is using Cassandra, but I don't believe any of those sites run off Rails. My question is whether or not it's feasible to use Cassandra using Ruby on Rails. Points to consider: We heavily rely on the Authlogic gem. Would switching to Cassandra affect how it works? Are there any mature ruby clients for Cassandra? Looking on Github it seems that fauna's client is the most mature. Has anyone had production experience with it? Appreciate any tips.

    Read the article

  • Ruby/Rails display general screen when modifications being performed on server

    - by john chan
    I have a ruby on rails app running a server and sometimes it needs to be taken down for updates/etc. As of now, one way I see to have a general display screen during update periods (when the app is down) is to substitute the files within /srv/www/ directory to just have it display a general screen everywhere that the user could possibly navigate to. I also thought of having a central controller file that connects all others (essentially a main) but this seems counter intuitive for rails. There are many external links to these different components of the site that the user could navigate to from outside and I need to make sure that they always receive this general update screen when the app is taken down for a little. I was wondering if anyone had any other ideas.... maybe a library or something like that, I can't seem to find anything online. any suggestions would be appreciated. Thanks

    Read the article

  • Graphing new users by date in a Rails app using Seer

    - by Danger Angell
    I'd like to implement a rolling graph showing new users by day over the last 7 days using Seer. I've got Seer installed: http://www.idolhands.com/ruby-on-rails/gems-plugins-and-engines/graphing-for-ruby-on-rails-with-seer I'm struggling to get my brain around how to implement. I've got an array of the Users I want to plot: @users = User.all( :conditions = {:created_at = 7.days.ago..Time.zone.now}) Can't see the right way to implement the :data_method to roll them up by created_at date. Anyone done this or similar with Seer? Anyone smarter than me able to explain this after looking at the Seer sample page (linked above)?

    Read the article

  • Integrate Jasper in Rails 3

    - by AndreDurao
    I'm trying to integrate a rails 3 app with jasper following this wiki: http://wiki.rubyonrails.org/rails/pages/HowtoIntegrateJasperReports But it seems that a lot of information isn't updated so it's been very hard to make it work by myself. I've also read a topic at ruby-forum: http://www.ruby-forum.com/topic/139453 with some details explained but still couldn't make it work. My first problem is related with the render_to_string method: When the controller method runs I receive a "Template is missing" error: this is the method: def report @customers = Customer.all send_doc(render_to_string(:template => report_customers_path, :layout => false), '/pdfs', 'report.jasper', "customers", 'pdf') end Although this seems simple I'm not understanding why is this happening. Doesn't render_to_string with layout = false suposed to get me the string result of that action? I also tried :action instead of :template, but it does the same. If anybody with some expertise with this integration could help... Thanks in advance, André

    Read the article

  • rails is loading from routes instead of the public folder

    - by djacobs7
    I have a rails app. I have a file in #{RAILS_ROOT}/public/swfs/somthing.swf. Locally, when running with webrick, when I go to the url localhost:3000/swfs/something.swf, my swf loads just fine. My routes.rb file looks like the following ActionController::Routing::Routes.draw do |map| map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' end Then, I started running the app with apache. When I visit myurl.com/swfs/something.swf, I get the following error message: Routing Error No route matches "/swfs/something.swf" with {:method=>:get} It looks like, for some reason, it is loading using the rails routes, instead of going to the public folder first. Any suggestions?

    Read the article

  • [Rails] OAuth with Digg API

    - by Karl
    I'm attempting to get Rails to play nice with the Digg API's OAuth. I'm using the oauth gem (ruby one, not the rails one). My code looks approximately like this: @consumer = OAuth::Consumer.new(API_KEY, API_SECRET, :scheme => :header, :http_method => :post, :oauth_callback => "http://locahost:3000", :request_token_url => 'http://services.digg.com/1.0/endpoint?method=oauth.getRequestToken', :access_token_url => 'http://services.digg.com/1.0/endpoint?method=oauth.getAccessToken', :authorize_url => 'http://digg.com/oauth/authorize') @request_token = @consumer.get_request_token session[:request_token] = @request_token.token session[:request_token_secret] = @request_token.secret redirect_to @request_token.authorize_url Which is by-the-book in terms of what the gem documentation gave me. However, Digg spits a "400 Bad Request" error back at me when @consumer.get_request_token is called. I can't figure out what I'm doing wrong. Any ideas?

    Read the article

  • Test (with RSpec) a controller outside of a Rails environment

    - by ramon.tayag
    I'm creating a gem that will generate a controller for the Rails app that will use it. It's been a trial and error process for me when trying to test a controller. When testing models, it's been pretty easy, but when testing controllers, ActionController::TestUnit is not included (as described here). I've tried requiring it, and all similar sounding stuff in Rails but it hasn't worked. What would I need to require in the spec_helper to get the test to work? Thanks!

    Read the article

  • building a backend for generating webquests with rails

    - by buk
    hello, i want to learn rails and as a project to learn rails i came across webquests. what a webquest is is clearly written here1 and this is a example how a webquest look like. i started with script/generate nifty_scaffold introduction index and repeat this for every section like task , Process, Evaluation and so on. but i dont think thats the right way because i have a lot of code for the same thing. on the other side i am more flexible on designing views or controllers instead of having only one controller foer all pages. i am not asking here to get code. i am asking who to "build" such a backend where you can click on "New Webquest" a form comes up and you can enter all the text who belongs to the topic. maybee i can add some drawings later. i hope anyone can show me how to do that. or post me some links or some rtfms :D regards, buk

    Read the article

  • Rails Plugin - Install as Plugin or Install As Gem

    - by Joseph Misiti
    Hey guys, I am new to rails and have a question regarding the plugins. It seems there are two approaches you can take when using a third party plugin in a ROR App: 1) install a gem using sudo gem install GEM, and then "require" it in your rails project 2) install the plugin using script/generate plugin install PLUGIN. The plugin in code appears in your vendor directory and then you are good to go (sometimes, i could not get Devise working via this method). Since it appears both of these methods accomplish them same thing, why should I choose one method over the other. Thanks,

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >